function showCreditCardPayment(val)
{
	var frm = document.forms["gift_card_form"];
	if(val=="Credit Card")
	{
		document.getElementById(val).style.display="";
		document.getElementById("paymentmode").focus();
	}
	else
	{
		document.getElementById("cc").style.display="none";
		alert("You will now be redirected to PayPal Account Page.");
		frm.action = "http://www.paypal.com";
		frm.submit();
	}
}



function popup(href,width,height)
{
window.open(href,"my_new_window","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width="+width+", height="+height)
}




var interval;
function showjob(val,total)
{
var totalHeight = 139;
for(var v=0; v<total; v++)
{
	document.getElementById("job"+v).style.display="none";
}

document.getElementById("job"+val).style.display="";
document.getElementById("job"+val).style.overflow="hidden";
document.getElementById("job"+val).style.height ="0px";
interval = setInterval("showbox("+val+","+totalHeight+")", 10);

}

function showbox(val,totalHeight)
{

var currentHeight = document.getElementById("job"+val).style.height.split("px");

if(parseInt(currentHeight[0]) <totalHeight)
{
var newH = parseInt(currentHeight[0])+4;
document.getElementById("job"+val).style.height = newH+"px"
} 
else
{
clearInterval(interval);
}
}


///// GIFT CARD //////////////
var interval2;



function show_gc(val, check)
{
inactivateGc();

// triggers when Next button is clicked
if(check==1) var status =  validategc(val);

if(status) val = status;

			

			if(document.getElementById("gc"+val).style.display == "none")
			{
			for(var v=1; v<=4; v++)
			{
			document.getElementById("gc"+v).style.display="none";
			document.getElementById("gch"+v).style.backgroundColor = "#DAEAF8";
			document.getElementById("gch"+v).style.color = "#0C6EA5";
			}
			
			var totalHeight = parseInt(document.getElementById("gc"+val).style.height.split("px")[0]);
			document.getElementById("gc"+val).style.display="";
			document.getElementById("gc"+val).style.overflow="hidden";
			document.getElementById("gc"+val).style.height ="0px";
			document.getElementById("gch"+val).style.backgroundColor = "#0C6EA5";
			document.getElementById("gch"+val).style.color = "#FFFFFF";
			interval2 = setInterval("opengc("+val+","+totalHeight+")", 10);
			}
	
}

function opengc(val,totalHeight)
{

var currentHeight = document.getElementById("gc"+val).style.height.split("px");

if(parseInt(currentHeight[0]) <totalHeight)
{
var newH = parseInt(currentHeight[0])+4;
var newH2  =  (parseInt(totalHeight- newH)/20)+ newH ;

document.getElementById("gc"+val).style.height = newH2+"px";
}

else
{
clearInterval(interval2);

resetGc();
}
}



function resetGc()
{
document.getElementById("gc1").style.height = gc1_h;
document.getElementById("gc2").style.height = gc2_h;
document.getElementById("gc3").style.height = gc3_h;
document.getElementById("gc4").style.height = gc4_h;
;
		

document.getElementById("gc1").onclick = function (){ show_gc(1) };
document.getElementById("gc2").onclick = function (){ show_gc(2) };
document.getElementById("gc3").onclick = function (){ show_gc(3) };
document.getElementById("gc4").onclick = function (){ show_gc(4) };

}


function inactivateGc()
{
document.getElementById("gc1").onclick = function (){ };
document.getElementById("gc2").onclick = function (){ };
document.getElementById("gc3").onclick = function (){ };
document.getElementById("gc4").onclick = function (){ };

}

function validategc(val)
{
var status;	
if(val==1) {
	document.getElementById("gc_stat1").innerHTML = "(errors)";
	status=validate("card_value", "req", "Please enter appropriate Card Value"); if(status==false) return 1;
	status=validate("card_value", "num", "Card Value can only be Numeric Value"); if(status==false) return 1;
	document.getElementById("gc_stat1").innerHTML = "(done)";
	return 2;
}
if(val==2) {
	document.getElementById("gc_stat2").innerHTML = "(errors)";
	status=validate("firstname","req","Please enter the Your First Name"); if(status==false) return 2;
	status=validate("lastname","req","Please Select the Your Last Name"); if(status==false) return 2;
	status=validate("address1","req","Please enter Your Address"); if(status==false) return 2;
	status=validate("city","req","Please enter the Your City Name"); if(status==false) return 2;
	status=validate("state","req","Please enter the Your State"); if(status==false)  return 2;
	status=validate("zip","req","Please enter the Your Zip Code"); if(status==false)  return 2;
	status=validate("zip","minlen=6","Please enter the Your Zip Code"); if(status==false) return 2; 
	status=validate("zip","num","Please enter the Your Zip Code"); if(status==false)  return 2; 
	status=validate("phone1","req","Please enter the Your Phone Number"); if(status==false) return 2;
	status=validate("email","req","Please enter the Your Email Address"); if(status==false)  return 2;
	status=validate("email","email","Please enter Proper Your Valid  Email"); if(status==false)  return 2;
	document.getElementById("gc_stat2").innerHTML = "(done)";
	return 3;
}

if(val==3) {
	document.getElementById("gc_stat3").innerHTML = "(errors)";
	status=validate("gift_firstname","req","Please enter First Name"); if(status==false)  return 3;
	status=validate("gift_lastname","req","Please Select Last Name"); if(status==false)  return 3;
	status=validate("gift_address1","req","Please enter Address"); if(status==false)  return 3;
	status=validate("gift_city","req","Please enter City Name"); if(status==false)  return 3;
	status=validate("gift_state","req","Please enter State"); if(status==false)  return 3;
	status=validate("gift_zip","req","Please enter Zip Code"); if(status==false) return 3;
	status=validate("gift_zip","minlen=5","Please enter Valid Zip Code"); if(status==false) return 3; 
	status=validate("gift_zip","num","Please enter valid Zip Code"); if(status==false)  return 3; 
	status=validate("gift_phone1","req","Please enter Phone Number"); if(status==false) return 3;
	status=validate("gift_email","email","Please enter Proper Valid  Email"); if(status==false)  return 3;
	document.getElementById("gc_stat3").innerHTML = "(done)";
	return 4;
}
if(val==4) {
	document.getElementById("gc_stat4").innerHTML = "(errors)";
	status=validate("ccname","req","Please enter your Name as on your Credit Card"); if(status==false)  return 4;
	status=validate("ccno","req","Please enter Credit Card Number"); if(status==false)  return 4;
	status=validate("ccv","req","Please enter CCV Number"); if(status==false)  return 4;
	status=validate("expmonth","dontselect=0","Please choose valid expiry month/year"); if(status==false)  return 4;
	status=validate("expyear","dontselect=0","Please choose valid expiry month/year"); if(status==false)  return 4;

	document.getElementById("gc_stat4").innerHTML = "(done)";
	document.getElementById("gift_card_form").submit();
}
}


function bill2gift(val)
{
	if(val==true) {
	 document.getElementById("gift_firstname").value=document.getElementById("firstname").value 	
	 document.getElementById("gift_lastname").value=	document.getElementById("lastname").value 
	 document.getElementById("gift_address1").value=	document.getElementById("address1").value 
	 document.getElementById("gift_address2").value=	document.getElementById("address2").value 
	 document.getElementById("gift_city").value=	document.getElementById("city").value 	
	 document.getElementById("gift_state").value=	document.getElementById("state").value 	
	 document.getElementById("gift_zip").value=	document.getElementById("zip").value 	
	 document.getElementById("gift_phone1").value=	document.getElementById("phone1").value 	
	 document.getElementById("gift_email").value=	document.getElementById("email").value 	

	}
}


function goToGift()
{
	var amount = document.getElementById("amt").value;	
	location.replace("index.php?goto=11&amt="+amount);
}


////////// MENU CARD //////////////
var menuInterval;
function showmenu(val, total)
{
var totalHeight = 310;

for(var v=0; v<total; v++)
{
	document.getElementById("menu"+v).style.display="none";
	document.getElementById("title"+v).style.display="none";
	document.getElementById("arrowsDiv"+v).style.display = "none";
}


document.getElementById("title"+val).style.display="";
document.getElementById("menu"+val).style.display="";
document.getElementById("menu"+val).style.overflow="auto";
document.getElementById("menu"+val).style.height ="0px";



document.getElementById("backlink").style.visibility = "visible";	
document.getElementById("menu"+val).style.top = "0px";
//alert(document.getElementById("menu"+val).style.top);
interval = setInterval("openMenu("+val+","+totalHeight+")", 10);

	
	
}



function openMenu(val,totalHeight)
{
var currentHeight = document.getElementById("menu"+val).style.height.split("px");

if(parseInt(currentHeight[0]) <totalHeight)
{
var newH = parseInt(currentHeight[0])+4;
var newH2  =  (parseInt(totalHeight- newH)/20)+ newH ;
document.getElementById("menu"+val).style.height = newH2+"px"
} 
else
{
	
	
clearInterval(menuInterval);

layerHeight = document.getElementById("items"+val).offsetHeight;
contHeight = parseInt((document.getElementById("menu"+val).style.height.split("px"))[0]);
//alert(layerHeight);
if(layerHeight>contHeight) document.getElementById("arrowsDiv"+val).style.display = "";

}
}



function showAllMenu(total)
{
	document.getElementById("backlink").style.visibility = "hidden";
	
for(var v=0; v<total; v++)
{
	document.getElementById("menu"+v).style.display="none";
	document.getElementById("title"+v).style.display="";
	document.getElementById("arrowsDiv"+v).style.display = "none";
}	
	
	
}

