//all javascripts that are SITE SPECIFIC, and probably cannot be reused in other site, go in this file

//WINNING EDGE FUNCTIONS

function toggleProdOpt(colName,area){ //admin function
	//if the current product option checkbox is checked, then open the details div for that option - if the checkbox was just unchecked, then close the div
	pathPrefix=getPathPrefix(area,1)
	divObj=findObjectPath('div_'+colName,area);
	checkObj=findObjectPath('check_'+colName,area);
	//toggle the content div
	divObj.style.display = (checkObj.checked==true) ? 'block' : 'none';
	//checkPopSize();
}

function showProdDetail(step,pid,data,hideLoading){
	//alert('showProdDetail, step: '+step);
	switch(step){
		case 1:
			//alert('prepping page');
			goPage(curURL+'#'+(pid!=0?('pid='+pid):'')); //update the URL bar
			if(hideLoading!=1){
				$("#loadingAnim").css({display:'block',opacity:0}).fadeTo(300,.90,function(){/*$("#prodDataDiv").html('');*/showProdDetail(2,pid,data,hideLoading);});
			}else{
				showProdDetail(2,pid,data,hideLoading);
			}
		break;
		case 2:
			//alert('sending post');
			//searchVals={pid:data,txt:$("#txt").val(),pg:$("#pg").val(),cat:$("#cat").val(),sub:$("#sub").val(),qty:$("#qty").val(),price:$("#price").val()};
			searchVals={pid:pid,pct:data};
			$.post("/product-details.php?",searchVals,function(html){showProdDetail(3,pid,html,hideLoading);});
		break;
		case 3:
			//alert('loading new data');
			$("#prodDataDiv").html('');
			$("#prodDataDiv").html(data);
			//remove the loading anim if requested
			if(hideLoading!=1){$("#loadingAnim").fadeOut(300);}
			//update the vert product scroller display
			//$("#motioncontainer").css("display",(pid!=0?"block":"none")); 
			//load products into the vert scroller if needed
			if(pid==0){$("#motioncontainer").html('&nbsp;');}
			if(pid!=0 && $("#motioncontainer").html()=="&nbsp;"){/*alert('load side bar');*/$.get("/product-scroller.php?",{},function(html){$("#motioncontainer").html(html);});}
		break;
	}
}


