function openhelp(inpage,inheight,inwidth)
	{
	var helpWin = null;
	if ((!helpWin) || (helpWin.closed)){ 
		helpWin=window.open(inpage,"Help","scrollbars=yes,resizable=no,menuBar=0,width=" + inwidth + ",height=" + inheight); 
	}
}	

function checkentry(InFormName, InCart, ncolorcount, qtytype) {	
	var submitpage=0;
	var ncolors=0;
	var nstr1=new String(document.forms[InFormName].specinstr.value);		

	//Count Colors
	if(document.forms[InFormName].color1.value!='') ncolors++;
	if(document.forms[InFormName].color2.value!='') ncolors++;
	if(document.forms[InFormName].color3.value!='') ncolors++;

	//Quantity Check
	if(qtytype==1) {
		var qtyleft=parseInt(document.forms[InFormName].qtyfacingleft.value);
		var qtyright=parseInt(document.forms[InFormName].qtyfacingright.value);
		var totalqty=parseInt(qtyleft + qtyright);
		if(totalqty==0 && submitpage==0) {
			alert('Please check your quantities.');
			submitpage=1;
		}		
	} else {
		
	
	}
		
	//Check to make sure they selected at least one color.
	if(ncolors==0 && submitpage==0) {
		alert('Please select at least one color to continue.');
		submitpage=1;
	}
		
	//Make sure colors are not the same
	if((document.forms[InFormName].color1.value==document.forms[InFormName].color2.value) && document.forms[InFormName].color1.value!='' && submitpage==0) {
		alert('Your main color and secondary color are the same, please make sure that none of your colors are the same.');		
		submitpage=1;				
	}

	//Make sure colors are not the same
	if((document.forms[InFormName].color1.value==document.forms[InFormName].color3.value) && document.forms[InFormName].color1.value!='' && submitpage==0) {
		alert('Your main color and third color are the same, please make sure that none of your colors are the same.');		
		submitpage=1;				
	}

	//Make sure colors are not the same
	if((document.forms[InFormName].color2.value==document.forms[InFormName].color3.value) && document.forms[InFormName].color2.value!='' && submitpage==0) {
		alert('Your secondary color and third color are the same, please make sure that none of your colors are the same.');		
		submitpage=1;				
	}
						
	//Check to see if they have enter instructions
	if(ncolors!=ncolorcount && ncolorcount!=0 && submitpage==0 && (nstr1=='' || nstr1==' ' || nstr1=='  ')) {
		alert('Please enter a description into the Special Instructions on how you would like your colors applied to the decal.');		
		submitpage=1;
	}
		
	//If no problems then go ahead and submit page		
	if(submitpage==0){
		if(InCart==1) { 
			document.forms[InFormName].addtocart.value=1; 
		} else {
			document.forms[InFormName].pricecheck.value=1; 
		}
		document.forms[InFormName].submit();
	}		
}

function checkentrycustomdecal(InFormName, InCart, ncolorcount, qtytype) {	
	var submitpage=0;
	var ncolors=0;
	var nstr1=new String(document.forms[InFormName].specinstr.value);		

	//Count Colors
	if(document.forms[InFormName].color1.value!='') ncolors++;
	if(document.forms[InFormName].color2.value!='') ncolors++;
	if(document.forms[InFormName].color3.value!='') ncolors++;

	//Quantity Check
	if(qtytype==1) {
		var qtyleft=parseInt(document.forms[InFormName].qtyfacingleft.value);
		var qtyright=parseInt(document.forms[InFormName].qtyfacingright.value);
		var totalqty=parseInt(qtyleft + qtyright);
		if(totalqty==0 && submitpage==0) {
			alert('Please check your quantities.');
			submitpage=1;
		}		
	} else {
		
	
	}
		
			
	//Check that they selected a font
	if(document.forms[InFormName].sfont.value==0) {
		alert('Please select a font to continue.');
		submitpage=1;	
	}
	
		
	//Check to make sure they selected at least one color.
	if(ncolors==0 && submitpage==0) {
		alert('Please select at least one color to continue.');
		submitpage=1;
	}
		
	//Make sure colors are not the same
	if((document.forms[InFormName].color1.value==document.forms[InFormName].color2.value) && document.forms[InFormName].color1.value!='' && submitpage==0) {
		alert('Your main color and secondary color are the same, please make sure that none of your colors are the same.');		
		submitpage=1;				
	}

	//Make sure colors are not the same
	if((document.forms[InFormName].color1.value==document.forms[InFormName].color3.value) && document.forms[InFormName].color1.value!='' && submitpage==0) {
		alert('Your main color and third color are the same, please make sure that none of your colors are the same.');		
		submitpage=1;				
	}

	//Make sure colors are not the same
	if((document.forms[InFormName].color2.value==document.forms[InFormName].color3.value) && document.forms[InFormName].color2.value!='' && submitpage==0) {
		alert('Your secondary color and third color are the same, please make sure that none of your colors are the same.');		
		submitpage=1;				
	}
						
	//Check to see if they have enter instructions
	if(ncolors!=ncolorcount && ncolorcount!=0 && submitpage==0 && (nstr1=='' || nstr1==' ' || nstr1=='  ')) {
		alert('Please enter a description into the Special Instructions on how you would like your colors applied to the decal.');		
		submitpage=1;
	}
		
	//If no problems then go ahead and submit page		
	if(submitpage==0){
		if(InCart==1) { 
			document.forms[InFormName].addtocart.value=1; 
		} else {
			document.forms[InFormName].pricecheck.value=1; 
		}
		document.forms[InFormName].submit();
	}		
}


