// CUSTOM JS FILE
			var zoomDone = new Array();
	
// SWITCH IMAGE BASED ON COLOR
		/*	function switchcolor(colorcode,attributeid){
			
				//document.getElementById("attribute"+attributeid).options[document.getElementById("attribute"+attributeid).selectedIndex].text = colorcode;
				
				for(var i=0; i<document.getElementById("attribute"+attributeid).length; i++ )
				{
				
					var colorLen = colorcode.length;
					var matchstr = document.getElementById("attribute"+attributeid).options[i].text;
					var selectval = matchstr.substr(0,colorLen);
					if(selectval == colorcode)
					{
						document.getElementById("attribute"+attributeid).selectedIndex = i;
						break;
					}
				}
				// Show particular image based on small color image selection
				// Hide all images on slect element change action
				jQuery("#imageShowcase a").hide();
				
                
				  jQuery("#productImg" + colorcode).show();
				jQuery("#anchorproductImg" + colorcode).show();
				var options = {

							zoomWidth: 300,

							zoomHeight: 300,
							
							showEffect: 'show',

							hideEffect: 'fadeout',

							fadeoutSpeed: 'slow',

							//zoomType:'reverse',
							
							title: false,
							
							yOffset: 70


						}
				// Get the content (aka inner HTML) of selected option
                var optionValueText = jQuery.trim(jQuery('#attribute'+attributeid+' :selected').text());
				//alert(optionValueText);
               // jQuery("#productImg" + optionValueText).show();
				//jQuery("#anchorproductImg" + optionValueText).show();
				if(zoomDone.indexOf(optionValueText) < 0)
            	{
            		jQuery("#anchorproductImg" + colorcode).jqzoom(options);
            		zoomDone.push(colorcode);
            	}
				
				alert("attribute"+attributeid);
            	document.getElementById("attribute"+attributeid).enable();
            	spConfig.fillSelect(document.getElementById("attribute"+attributeid));
            	
		}*/
		
// SWITCH MAIN IMAGE BASED ON MORE IMAGES ON MEDIA FILE
function switchmore(imagename){	
				// Show particular image based on small color image selection
				// Hide all images on slect element change action
				$("#imageShowcase a").hide();

				$("#productImg" + imagename).show();
				$("#anchorproductImg" + imagename).show();
				var options = {

							zoomWidth: 300,

							zoomHeight: 300,
							
							showEffect: 'show',

							hideEffect: 'fadeout',

							fadeoutSpeed: 'slow',
							
							title: false,
							
							yOffset: 70


						}
				
				if(!zoomDone.in_array(imagename))
            	{
            		$("#anchorproductImg" + imagename).jqzoom(options);
            		zoomDone.push(imagename);
            	}
            	
		}
	
	//IN ARRAY FUNCTION
	Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
		return false;
	}
	

// Switch Embroidery	
function switchEmbriodery(checkval)
{
	if(checkval.checked)
	{
		document.getElementById("EmbroideryDiv").style.display = 'block';
	}
	else
	{
		// Set all rsdio buttons to unchecked if any one is checked on unchecked of main checkbox
		var nodes = document.getElementById("EmbroideryDiv").getElementsByTagName("input");
		for(i=0;i<nodes.length;i++)
		{
			var inputtype = nodes.item(i).getAttribute("type");
			if(inputtype == 'radio')
			{
				nodes.item(i).checked = false;
			}
		}
	
		document.getElementById("EmbroideryDiv").style.display = 'none';
	}

}


// Add Require Class to text feild
function AddRequire(embrioderyVal)
{
	//alert(embrioderyVal);
	if(embrioderyVal.substr(0,10).toLowerCase()=='embroidery')
	{
		var nodes = document.getElementById("changeclass").getElementsByTagName("input");
		for(i=0;i<nodes.length;i++)
		{
		var classpart = nodes.item(i).getAttribute("class").substr(11,nodes.item(i).getAttribute("class").length);
		var requireclass = "input-text required-entry "+classpart;
		nodes.item(i).setAttribute("class",requireclass);
		//alert(nodes.item(i).getAttribute("class"));
       
		}

	}
}
	
	
