/* ========================================================
 *  JS used on productDetail.aspx 
 * ======================================================== */
function nogo() { ; }



function ChangeDropDown(color) { //changes dropdown selection when swatch is clicked
			
	var pullDownSize = document.CartForm.buyPull.length; // number of items in our pulldown
	
	// so we stop on the FIRST size of a matching color, not the last
	var stopBit = 0;
	
	// step through each;
	for( var i=0; i<document.CartForm.buyPull.length; i++ )
	{
		// pullDownItem[0] should contain our color name (all caps)
		var pullDownItem = document.CartForm.buyPull.options[i].text.split(" - ")
		
		if( pullDownItem[0] == color )
		{
			if( stopBit == 0){
				document.CartForm.buyPull.selectedIndex = i;
			}
			stopBit = 1;
		}
	}
	
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		preloadFlag = true;
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator){
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
			}
		}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; 
		for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

function P7_ShowPic(a,b) { //v2.0 by PVII
	var g,gg,d,dd,ic,im;
 	if((g=MM_findObj(b))!=null){
 		if(!document.P7ShowPic){
 			document.P7ShowPic=true;
	}
	else{
 		if((d=MM_findObj(document.P7SPlay))!=null){
			dd=(document.layers)?d:d.style;dd.visibility="hidden";
			}
		}
		document.P7SPlay=b;gg=(document.layers)?g:g.style;im=b+"im";
		if((ic=MM_findObj(im))!=null){ic.src=a;gg.visibility="visible";
		}
	}
}
function switch1(div, imagechange){//FOR THE DESCRIPTION TABS
	if (document.getElementById('one'))
		{
			var divArray=['one','two','four'];
			for(var i=0; i<divArray.length; i++)
				{ 
				obj=document.getElementById(divArray[i]);
				obj2=document.getElementById(divArray[i]+'_img');
				
				obj.style.display=(divArray[i]==div)? "block" : "none"; 
				obj2.src=obj2.src.replace(/_on\.gif$/,'_off.gif');
				
				}
			document.getElementById(div+'_img').src = imagechange;
		}
}

function recordBackOrder ( args ) {
	var selectorObject = args.selectorObject;
	if(selectorObject[selectorObject.selectedIndex].text.indexOf("*") < 0)return;
	var s=s_gi('dcdctsuboprod')
	s.prop3=selectorObject[selectorObject.selectedIndex].value.replace(/\s*/g, '');
	s.eVar13=selectorObject[selectorObject.selectedIndex].value.replace(/\s*/g, '');
	s.tl(true,'o','backordered')
}


function validate() {
	createCookie('returnUrl',document.location.href,0);

	if( document.CartForm.buyPull.selectedIndex == 0 ) {
		alert('Please select a size and color.');
	    return false;
	}
	return true;
}

		$(function() {
			$('#descriptionDiv > ul').tabs({ fx: { opacity: 'toggle' } });
          });
          
    /*this is for omniture tracking ///////////////////////////////////*/
	$(document).ready(function () {
	    $("#desct a").click(function (event) { 
	            event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Description";
			    s.tl(this,'o', 'desct'); 
		});	   
	    $("#techt a").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Technology";
			    s.tl(this,'o', 'techt'); 
		});	  
	    $("#returnt a").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Returns";
			    s.tl(this,'o', 'returnt'); 
		});	  
	    $("#warrt a").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Warranty and Exchanges";
			    s.tl(this,'o', 'warrt'); 
		});	  
	    $("#revt a").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Reviews";
			    s.tl(this,'o', 'revt'); 
		});	   
	    $("#emailFriendBtn").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Email a Friend";
			    s.tl(this,'o', 'Email A Friend'); 
		});
		$("#sizeChart").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Sizing Info";
			    s.tl(this,'o', 'sizing info'); 
		});	   
		$("#shipRatesPop").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Shipping Info";
			    s.tl(this,'o', 'shipping info'); 
		});	   
		
		$("#chatClick").click(function (event) { 
		        event.preventDefault();
			    s.linkTrackVars='prop11'; 
			    s.prop11="pdp: Chat Click";
			    s.tl(this,'o', 'Chat Click'); 
		});	   

	});
	/*this is for omniture tracking ///////////////////////////////////*/		