
function pageInit() {
	for (i = 1; i <= 3; i++) {
		$('#imgLnk_' + (i)).hide();
	}

	changeData(skus.colors[skus.displayedColor], skus.colors[skus.displayedColor].displayedSize);

	// Load Zoom Effect where present on click - Item Page

	$(".myzoom").jqzoom(zconfig);
	$(".myzoom").unbind();
	$('#control-zoom a').toggle(
		function() {
			zoomstate = 1;
			changeData(skus.colors[skus.displayedColor], skus.colors[skus.displayedColor].displayedSize);
			$("#control-zoom a").html("HOVER TO ZOOM");
		},
		function(){
			zoomstate = 0;
			$(".myzoom").unbind()
			$(".myzoom").attr("href","javascript:void(0)");
			$("#control-zoom a").html("CLICK TO ZOOM");
		}
	);

	$("#video").jqm({modal:true});
	$("#threed").jqm({modal:true});
}

// Now for complete generic execution

var skus = {};	// base init

$(document).ready(function(){  
	// get JSON data - we read the id to throw from DOM.
	$.ajaxSetup({ async: false});
	
	$.ajaxSetup({"error": function(XMLHttpRequest,textStatus, errorThrown) {         
		//alert(textStatus);      
		//alert(errorThrown);      
		//alert(XMLHttpRequest.responseText);  
	} } );	

	var params = {};
	params.itemId = $("#itemId").val();
	params.colorId = $("#colorId").val();
	params.method = "size";
	$.getJSON("/itemJson.jsp", params,
		function(data) {
			skus = data;
		}
	);
	pageInit();
	
});
