var ok = (document.images ? true : false);
// PopUps
function open_cvv2() { windowtext = window.open("xhtml/popup_cvv2.html","text","width=560,height=560,resizable=1,scrollbars=1"); }
function open_image(page) { windowtext = window.open(page,"text","width=450,height=470,resizable=1,scrollbars=0"); }
function open_text() { windowtext = window.open("xhtml/popup_text.html","text","width=560,height=520,resizable=1,scrollbars=1"); }
function getQuotes(quote) { windowtext = window.open("/eoneCommerce/Shop?dsp=40120&quote=" + quote,"text","width=760,height=520,resizable=1,scrollbars=1"); }
function freeGifteNoucement() { windowtext = window.open("xhtml/popup_enouncement.html","text","width=825,height=600,resizable=1,scrollbars=1"); }
function popup(page,width,height) { 
var x = 0, y = 0; // default values
if (document.all){ x = window.screenLeft + 140; y = window.screenTop + 120; }
else if (document.layers){ x = window.screenX + 140; y = window.screenY + 120; }
windowtext = window.open(page,"text","width=" + width + ",height=" + height + ",resizable=0,scrollbars=0,left=" + x + ",screenX=" + x + ",top=" + y + "screenY=" + y);
}
function popupwscroll(page,width,height) { 
var x = 0, y = 0; // default values
if (document.all){ x = window.screenLeft + 140; y = window.screenTop + 120; }
else if (document.layers){ x = window.screenX + 140; y = window.screenY + 120; }
windowtext = window.open(page,"text","scrollbars=1,width=" + width + ",height=" + height + ",resizable=1,left=" + x + ",screenX=" + x + ",top=" + y + "screenY=" + y);
}
function rollover(whichimg,overimg) { if (ok) { eval('document.images["' + whichimg + '"].src = ' + overimg + '.src'); } }
mtop = 98; m10000 = 225; m20000 = 278; m30000 = 345; m40000 = 401; m50000 = 452; m60000 = 507; m70000 = 561; m80000 = 512; m90000 = 512; m92000 = 561; m71000 = 577; currentMenuImage = ""; currentMenuImageSrc = ""; menusHidden = 1;
function setCurrentRollover(img, imgValue){
currentMenuImage = img; currentMenuSrc = document.images[img].src; currentMenuImageSrc = imgValue;
}
function clearCurrentRollover(){ currentMenuImage = ""; currentMenuImageSrc = ""; }
function setRollover() { if ( currentMenuImage != "" ){ changeScene7Image(currentMenuImage,currentMenuImageSrc); } }
function resetRollover() { if ( currentMenuImage != "" ) { changeImage(currentMenuImage,currentMenuSrc); } }
//function hideAll() { hideMenu('m10000'); }
function showMenu(movlay,offset) { myObj = document.getElementById(movlay);	myObj.style.display=''; myObj.style.left= parseInt(offset) + "px";	myObj.style.top= parseInt(mtop) + "px"; hide('per_page_select'); hide('sortoptions'); hide('goto_page_select'); }//hide('pricerange');show('pricerangefiller'); }
function getOffset(el, which) { // Function for IE to calculate position of an element.
var amount = el["offset"+which];
if (which=="Top")
amount+=el.offsetHeight
else
amount+=el.offsetWidth
el = el.offsetParent
while (el!=null) {
amount+=el["offset"+which]
el = el.offsetParent
}
return amount
}
function showFloatingPopup(movlay)
{
	myObj = document.getElementById(movlay);
	myObj.style.display='';
	src = window.event.srcElement;
	x = window.event.x;
	y = window.event.y;
	if ( x != null )
	{
		myObj.style.left= x + "px";
		myObj.style.top= y + "px";
	}
}
function showFloatingPopup(evt, movlay)
{
	if ( movlay == null )
	{
		movlay = evt;
	}
	myObj = document.getElementById(movlay);
	myObj.style.display='';
	src = evt;
	/*
	src = evt;
	x = evt.x;
	y = evt.y;
	if ( x != null )
	{
		myObj.style.left= x + "px";
		myObj.style.top= getOffset(src, "Top");
	}
	*/
	myObj.style.top = evt.style.top;
	myObj.style.left = evt.style.left;
}
/*
function showFloatingPopup(evt, movlay)
{
	if ( movlay == null )
	{
		movlay = evt;
	}
	myObj = document.getElementById(movlay);
	myObj.style.display='';
	src = evt;
	
	src = evt;
	x = evt.x;
	y = evt.y;
	if ( x != null )
	{
		myObj.style.left= x + "px";
		myObj.style.top= getOffset(src, "Top");
	}
	
	
// Determine how much the visitor had scrolled

var scrolledX, scrolledY;
if( self.pageYOffset ) {
  scrolledX = self.pageXOffset;
  scrolledY = self.pageYOffset;
} else if( document.documentElement && document.documentElement.scrollTop ) {
  scrolledX = document.documentElement.scrollLeft;
  scrolledY = document.documentElement.scrollTop;
} else if( document.body ) {
  scrolledX = document.body.scrollLeft;
  scrolledY = document.body.scrollTop;
}

// Determine the coordinates of the center of the page

var centerX, centerY;
if( self.innerHeight ) {
  centerX = self.innerWidth;
  centerY = self.innerHeight;
  centerXb = self.innerWidth + self.scrollMaxX;
  centerYb = self.innerHeight + self.scrollMaxY;
} else if( document.documentElement && document.documentElement.clientHeight ) {
  centerX = document.documentElement.clientWidth;
  centerY = document.documentElement.clientHeight;
  centerXb = document.documentElement.scrollWidth;
  centerYb = document.documentElement.scrollHeight;
} else if( document.body ) {
  centerX = document.body.clientWidth;
  centerY = document.body.clientHeight;
  centerXb = document.body.scrollWidth;
  centerYb = document.body.scrollHeight;
}

var leftOffset = scrolledX + (centerX - 410) / 2;
var topOffset = scrolledY + (centerY - 282) / 2;

	myObj.style.top = topOffset + "px";
	myObj.style.left =  leftOffset + "px";
}
*/
function hideMenu(movlay) {	myObj = document.getElementById(movlay); myObj.style.display='none'; show('per_page_select'); show('sortoptions'); show('goto_page_select'); }//show('pricerange');hide('pricerangefiller'); }
function uncheckSatOvernight(){	if ( document.detail.satovernight != null )	{ document.detail.satovernight.checked = false;	} }//hide('satOvernightdiv'); } }//clearFutureDate(); }
function uncheckFutureSatOvernight(){ show('overnightoptionsfuture'); enableOAM(); hide('satFutureOvernightdiv'); for (i=0; i< document.detail.shipmethodoverride.length; i++) { document.detail.shipmethodoverride[i].disabled = false; }}
function uncheckOvernightAm(){	if ( document.detail.overnightam != null )	{ document.detail.overnightam.checked = false;	} }
function uncheckFutureOvernightAm(){ if ( document.detail.overnightamfuture != null ) { document.detail.overnightamfuture.checked = false;	} }
function clearFutureDate() { document.detail.date.value = ""; }
function deselectShipping() { uncheckFutureOvernightAm(); for (i=0; i< document.detail.SHIPMETHOD.length; i++) { document.detail.SHIPMETHOD[i].checked = false;	} }
function deselectFutureShipping() { uncheckOvernightAm(); for (i=0; i< document.detail.shipmethodoverride.length; i++) { document.detail.shipmethodoverride[i].checked = false; } }
isSat = false;
function enableOAM()
{
	if ( document.detail.overnightamfuture != null )
	{
		document.detail.overnightamfuture.disabled = false;
	}
	isSat = false;
}
function disableOAM()
{
	if ( document.detail.overnightamfuture != null )
	{
		document.detail.overnightamfuture.disabled = true;
	}
	isSat = true;
}
function selectOvernight(){
if ( document.detail.SHIPMETHOD != null )
{
	for (i=0; i< document.detail.SHIPMETHOD.length; i++)
	{
		if (document.detail.SHIPMETHOD[i].value == 4)
		{
			document.detail.SHIPMETHOD[i].checked = true;
		}
	}

    if ( document.detail.SHIPMETHOD.length == null )
	{
		document.detail.SHIPMETHOD.checked = true;
	}
	/*
	if ( document.detail.satovernight.checked )
	{
		show('satOvernightdiv');
		hide('overnightoptions');
	}
	else
	{
		hide('satOvernightdiv');
		show('overnightoptions');		
	}
	*/
//if ( document.detail.satovernight.checked == false ) { hide('satOvernightdiv'); }
//else { show('satOvernightdiv'); }
}
uncheckOvernightAm();
uncheckFutureOvernightAm();
clearFutureDate();
}
function selectOvernightForAm(){
uncheckSatOvernight();
uncheckFutureSatOvernight();
if ( document.detail.SHIPMETHOD != null )
{
	for (i=0; i< document.detail.SHIPMETHOD.length; i++)
	{
		if (document.detail.SHIPMETHOD[i].value == 4)
		{
			document.detail.SHIPMETHOD[i].checked = true;
		}
	}

    if ( document.detail.SHIPMETHOD.length == null )
	{
		document.detail.SHIPMETHOD.checked = true;
	}
	/*
	if ( document.detail.overnightam.checked )
	{
		hide('satOvernightdiv');
		show('overnightoptions');
	}
	else
	{
		show('satOvernightdiv');
		hide('overnightoptions');		
	}
	*/
//if ( document.detail.satovernight.checked == false ) { hide('satOvernightdiv'); }
//else { show('satOvernightdiv'); }
}
clearFutureDate();
}
function selectOvernightForFAm(){
if ( document.detail.shipmethodoverride != null )
{
	for (i=0; i< document.detail.shipmethodoverride.length; i++)
	{
		if (document.detail.shipmethodoverride[i].value == 4)
		{
			document.detail.shipmethodoverride[i].checked = true;
		}
	}

    if ( document.detail.shipmethodoverride.length == null )
	{
		document.detail.shipmethodoverride.checked = true;
	}
//if ( document.detail.satovernight.checked == false ) { hide('satOvernightdiv'); }
//else { show('satOvernightdiv'); }
}
uncheckSatOvernight();
uncheckFutureSatOvernight();
}
function selectFutureSat(){
if ( top.document.detail.shipmethodoverride.length == null )
{
	show('satFutureOvernightdiv');
}
else
{
	for (i=0; i< top.document.detail.shipmethodoverride.length; i++){
	if (top.document.detail.shipmethodoverride[i].value == 4){ top.document.detail.shipmethodoverride[i].checked = true; }
	else { top.document.detail.shipmethodoverride[i].disabled = true; }
	show('satFutureOvernightdiv');
	}
}
hide('overnightoptionsfuture');
}
function selectOvernightOnly(){
enableOAM();
hide('satFutureOvernightdiv');
if ( top.document.detail.shipmethodoverride.length == null )
{
	
}
else
{
	for (i=0; i< top.document.detail.shipmethodoverride.length; i++){
	if (top.document.detail.shipmethodoverride[i].value == 4){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }
	else { top.document.detail.shipmethodoverride[i].disabled = true; }
	}
}
}
function selectTwoDay(){
hide('satFutureOvernightdiv');
if ( top.document.detail.shipmethodoverride.length == null )
{
	
}
else
{
	for (i=0; i< top.document.detail.shipmethodoverride.length; i++){
	if (top.document.detail.shipmethodoverride[i].value == 3){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }
	else if (top.document.detail.shipmethodoverride[i].value == 4){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }
	else { top.document.detail.shipmethodoverride[i].disabled = true; }
	}
}
}
function selectThreeDay(){
hide('satFutureOvernightdiv');
if ( top.document.detail.shipmethodoverride.length == null )
{
	
}
else
{
	for (i=0; i< top.document.detail.shipmethodoverride.length; i++){
	if (top.document.detail.shipmethodoverride[i].value == 3){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }
	else if (top.document.detail.shipmethodoverride[i].value == 4){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }	
	else if (top.document.detail.shipmethodoverride[i].value == 2){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }	
	else { top.document.detail.shipmethodoverride[i].disabled = true; }
	}
}
}
function selectGround5Day(){
hide('satFutureOvernightdiv');
if ( top.document.detail.shipmethodoverride.length == null )
{
	
}
else
{
	for (i=0; i< top.document.detail.shipmethodoverride.length; i++){
	if (top.document.detail.shipmethodoverride[i].value == 3){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }
	else if (top.document.detail.shipmethodoverride[i].value == 4){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }	
	else if (top.document.detail.shipmethodoverride[i].value == 2){ top.document.detail.shipmethodoverride[i].checked = true;top.document.detail.shipmethodoverride[i].disabled = false; }	
	else { top.document.detail.shipmethodoverride[i].disabled = true; }
	}
}
}
function deselectFutureSat(){
for (i=0; i< top.document.detail.shipmethodoverride.length; i++){
top.document.detail.shipmethodoverride[i].disabled = false;
}
hide('satFutureOvernightdiv');
}
function changeImage(item, image) { document.images[item].src = image; }
scene7 = "http://s7ondemand1.scene7.com/is/image/DelightfulDeliveries/";
function returnScene7(theimage){ return scene7 + theimage; }
function changeScene7Image(theobject,theimage){ document.images[theobject].src = scene7 + theimage; }
function changeSourceCode(item){
if ( ( item == "Catalog" ) || ( item == "Magazine/Newspaper" ) || ( item == "TV/Radio" ) || ( item == "Other" ) || ( item == "Outdoor" ) ){
showdiv('sourcecodefield');hidediv('sourcecodecatalog');hidediv('sourcecodemagazine');hidediv('sourcecodetv');hidediv('sourcecodeother');
hidediv('sourcecodecataloghelp');hidediv('sourcecodemagazinehelp');
}else{
hidediv('sourcecodefield');hidediv('sourcecodecatalog');hidediv('sourcecodemagazine');hidediv('sourcecodetv');hidediv('sourcecodeother');
hidediv('sourcecodecataloghelp');hidediv('sourcecodemagazinehelp');
}
if ( item == "Catalog" ) { showdiv('sourcecodecatalog'); showdiv('sourcecodecataloghelp'); }
if ( item == "Magazine/Newspaper" ) { showdiv('sourcecodemagazine');showdiv('sourcecodemagazinehelp'); }
if ( item == "TV/Radio" ){ showdiv('sourcecodetv'); }
if ( item == "Other" ){showdiv('sourcecodeother');}
if ( item == "Outdoor" ){showdiv('sourcecodeother');}
}
function showdiv(movlay){ myObj = document.getElementById(movlay); if ( myObj != null ) {myObj.style.display='';} }
function hidediv(movlay){ myObj = document.getElementById(movlay); if ( myObj != null ) {myObj.style.display='none';} }
function updateReferral(value){
radio = document.checkout.referral;
for( var i=0; i < radio.length; i++ ){
if(radio[i].value == value){ radio[i].checked = true; changeSourceCode(value); }
}
}
function swapIt(div)
{
	myObj = document.getElementById(div);
	if ( myObj.style.display == '' )
	{
		hidediv(div);
	}
	else
	{
		showdiv(div);
	}
}
function swapDivs(div1,div2)
{
	myObj = document.getElementById(div1);
	myObj2 = document.getElementById(div2);
	hidediv(div1);
	showdiv(div2);
}

var itwoday = false;
var ithreeday = false;
var iovernight = false;
var iground5 = false;
var iground7 = false;
function hideItemDetails()
{
	badsku = true;
}
function dohideDetails()
{
	hide('s7tools');
	hide('itemtools');
	hide('itemoptions');
	hide('addtocartone');
}
function setMethods()
{
	if ( top.document.detail.shipmethodoverride != null )
	{
		if ( top.document.detail.shipmethodoverride.length == null )
		{
			if (document.detail.shipmethodoverride.value == 1){ iground5 = true; }
			if (document.detail.shipmethodoverride.value == 2){ ithreeday = true; }
			if (document.detail.shipmethodoverride.value == 3){ itwoday = true; }
			if (document.detail.shipmethodoverride.value == 4){ iovernight = true; }
			if (document.detail.shipmethodoverride.value == 5){ itwoday = true; }
			if (document.detail.shipmethodoverride.value == 6){ iground7 = true; }
			if (document.detail.shipmethodoverride.value == 8){ iovernight = true; }
		}
		else
		{
			for (i=0; i< document.detail.shipmethodoverride.length; i++){
			if (document.detail.shipmethodoverride[i].value == 1){ iground5 = true; }
			if (document.detail.shipmethodoverride[i].value == 2){ ithreeday = true; }
			if (document.detail.shipmethodoverride[i].value == 3){ itwoday = true; }
			if (document.detail.shipmethodoverride[i].value == 4){ iovernight = true; }
			if (document.detail.shipmethodoverride[i].value == 5){ itwoday = true; }
			if (document.detail.shipmethodoverride[i].value == 6){ iground7 = true; }
			if (document.detail.shipmethodoverride[i].value == 8){ iovernight = true; }
			}
		}
	}
}

var expDays = 7;
var page = "/xhtml/discover25.html";
var windowprops = "width=325,height=275,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
function GetCookie (name)
{
	var arg = name + "=";
	var alen = arg.length; 
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null; 
}
function SetCookie (name, value)
{
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : (";	path=" + path)) + ((domain == null) ? "" : (";	domain=" + domain)) + ((secure == true) ? ";	secure" : "");
}
function DeleteCookie (name)
{
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt()
{
	var count = GetCookie('count');
	if(count == null)
	{
		SetCookie('count','1');
		return 1;
	}
	else
	{
		var newcount = parseInt(count) + 1;
		DeleteCookie('count');
		SetCookie('count',newcount,exp);
		return count;
	}
}
function getCookieVal(offset)
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function checkCount()
{
	if ( (document.referrer != "") && ( document.referrer.indexOf("localhost") == -1 ) )
	{ 
		var count = GetCookie('count');
		if (count == null)
		{
			count=1;
			SetCookie('count', count, exp);
			window.open(page, "", windowprops);
		}
		else
		{
			count++;
			SetCookie('count', count, exp);
		}
	}
}

function moveTo(obj, x, y) {
        if (document.getElementById) {
        document.getElementById('menuDiv').style.left = x;
        document.getElementById('menuDiv').style.top = y;
        }
}

function init(){
        if(document.getElementById){
		showdiv("menuDiv");
        obj = document.getElementById("menuDiv");
        obj.style.top = "-147px";
        }
}

function slideDown(x){
        if(document.getElementById){
				//if(parseInt(obj.style.height) < x){
                if(parseInt(obj.style.top) < 100){
                        obj.style.top = parseInt(obj.style.top) + 10 + "px";
						//obj.style.height = parseInt(obj.style.top) + 10 + "px";
                        setTimeout("slideDown()",50);
                }
        }
}

function slideUp(){
        if(document.getElementById){
                if(parseInt(obj.style.top) > -147){
                        obj.style.top = parseInt(obj.style.top) - 10 + "px";
                        setTimeout("slideUp()",50);
                }
        }
}

function ShowHide(id, visibility) {
    divs = document.getElementsByTagName("div");
    divs[id].style.visibility = visibility;
}

function checkAdCount()
{
	var count = GetCookie('count');
	if (count == null)
	{
		count=1;
		showAd();
		SetCookie('count', count, exp);
		//init();slideDown();showdiv('menuShowBanner');setTimeout("slideUp()",10000);		
	}
	else
	{
		count++;
		SetCookie('count', count, exp);
	}
}
function setCartMessageSpan(message)
{
	var cartm = document.getElementById('itemsincartvalue');
	if ( cartm != null )
	{
		cartm.innerHTML = '<a HREF="https://www.delightfuldeliveries.com/eoneCommerce/Shop?dsp=40004">' + message + "</a>";
	}
}
function setCartMessage(message)
{
	var cartDiv = document.getElementById('itemsincartvalue');
	if ( cartDiv != null )
	{
		//cartDiv.innerHTML = '<span class="bodycream">' + message + "</span>";
		cartDiv.innerHTML = '<a HREF="https://www.delightfuldeliveries.com/eoneCommerce/Shop?dsp=40004">' + message + "</a>";
	}
}

function refineexpand(mov)
{
	myObj = document.getElementById(mov);
	if ( myObj.style.display == '' )
	{
		myObj.style.display = 'none';
	}
	else
	{
		myObj.style.display = '';
	}
}

function changeStyle(obj,stylename)
{
	obj.className = stylename;	
}

function gotoUrl( turl )
{
	window.location = turl;
}

function shippingValidate()
{
	b = 0;
	if ( shipnow )
	{
		fs = document.detail.SHIPMETHOD;

		for ( i=0; i != fs.length; i++ )
		{
			if ( fs[i] == null )
			{
				return true;
			}
			if ( fs[i].checked == true )
			{
				//b = fs[i].value;
				return true;
			}
		}
	}
	else
	{
		fs = document.detail.shipmethodoverride;
		
		if ( fs != null )
		{
			for ( i=0; i != fs.length; i++ )
			{
				if ( fs[i] == null )
				{
					return true;
				}
				if ( fs[i].checked == true )
				{
					//alert ( fs[i].value );
					//b = fs[i].value;
					return true;
				}
			}
		}
	}
	return false;
}

function addRecp ( )
{
	dropdown = document.getElementById('shiptolistselect');
	myindex = dropdown.selectedIndex;

	var result = dropdown.options[myindex].value;
	var sr = result.split("   ");
	var fname = sr[0];
	var lname = sr[1]; 
	var zip = sr[2];
	
	document.getElementById('firstname').value = fname;
	document.getElementById('lastname').value = lname;
	document.getElementById('zipcode').value = zip;
	checkshiprestriction(document.getElementById('zipcode'));
}
function setItemPrice ( p )
{
	document.getElementById('itemprice').value = p;
}


function readRadioValue(id)
{

		//alert("readRadioValue");
		if(top.document.detail.shipmethodoverride.length!=null)
		{
		for(i=0; i< top.document.detail.shipmethodoverride.length; i++)
		{
		
		if(top.document.detail.shipmethodoverride[i].disabled==true)
		{
		//alert(i + " disabled");
		}
		else
		{
		
		var pos=top.document.detail.shipmethodoverride[i].value;
		
		userSelectMethod=pos;
		var getValue=pos;
		top.document.detail.shipmethodoverride[i].checked = true;
		var amt;
		
		if(getValue == 1)
		amt = document.detail.SHIPMETHOD1.value;
		if(getValue == 2)
		amt = document.detail.SHIPMETHOD2.value;
		if(getValue == 3)
		amt = document.detail.SHIPMETHOD3.value;
		if(getValue == 4)
		amt = document.detail.SHIPMETHOD4.value;
		if(getValue == 5)
		amt = document.detail.SHIPMETHOD5.value;
		if(getValue == 6)
		amt = document.detail.SHIPMETHOD6.value;
		if(getValue == 7)
		amt = document.detail.SHIPMETHOD7.value;
		
		
		var currentQTY
		if(document.getElementById('QTY')!=null || document.getElementById('QTY')!=undefined)
		{
			
			if(document.getElementById('QTY').length > 0)
			currentQTY=document.getElementById('QTY').value;
		}
		else if(document.detail.reviewQTYEdit!=null)
		{
			
			
			currentQTY=document.detail.reviewQTYEdit.value;
			
		
		}
		else if(document.getElementById('ohQTYEdit')!=null)
		{
		currentQTY=document.getElementById('ohQTYEdit').value;
		}
		
		
		
		
		
		var intQty=parseInt(currentQTY);	
		var temp=new Array();
		temp = amt.split(" ");
		var price ;
		if(id==1)
		{
		var withoutDollar=temp[0].substring(1);
		originalAmount=parseFloat(withoutDollar)+parseFloat("15.00");//withoutDollar;
		var totalAmount=(parseFloat("15.00")+parseFloat(withoutDollar))*parseFloat(intQty);
		price="$"+totalAmount.toFixed(2);
		}
		else
		{
		price = temp[0].substring(1);
		
		originalAmount=price;
		price=trimString(price);
		price=parseFloat(price);
		
		price=price*parseFloat(intQty);
		
		price="$"+price.toFixed(2);
		
		}
		
		userClickAmount=trimString(price);
		
		selectedArrivalDatePrice=trimString(price);
		
		if(toCheckMorningArrival()==0)
		{
			document.detail.price12.value=trimString(price);
		}
		else
		{
			if(id==1)
			{
				document.detail.price12.value=trimString(price);
			}
			else
			{
				price=toCheckMorningArrival().toFixed(2);
				price=parseFloat(price);
				price=price*parseFloat(intQty);		
				price="$"+price.toFixed(2);
				document.detail.price12.value=price;
			}	
		}
		 
		break;
		}
		}
		}
		else {
		//alert("readRadioValue else");
		
		var pos=top.document.detail.shipmethodoverride.value;
		
		userSelectMethod=pos;
		var getValue=pos;
		top.document.detail.shipmethodoverride.checked = true;
		var amt;
		
		if(getValue == 1)
		amt = document.detail.SHIPMETHOD1.value;
		if(getValue == 2)
		amt = document.detail.SHIPMETHOD2.value;
		if(getValue == 3)
		amt = document.detail.SHIPMETHOD3.value;
		if(getValue == 4)
		amt = document.detail.SHIPMETHOD4.value;
		
		
		var currentQTY
		
		if(document.getElementById('QTY')!=null || document.getElementById('QTY')!=undefined)
		{
			
			if(document.getElementById('QTY').length > 0)
			currentQTY=document.getElementById('QTY').value;
		}
		else if(document.detail.reviewQTYEdit!=null)
		{
			
			
			currentQTY=document.detail.reviewQTYEdit.value;
			
		
		}
		else if(document.getElementById('ohQTYEdit')!=null)
		{
		currentQTY=document.getElementById('ohQTYEdit').value;
		}
		
		
		
		
		
		var intQty=parseInt(currentQTY);	
		var temp=new Array();
		temp = amt.split(" ");
		var price ;
		
		if(id==1)
		{
		var withoutDollar=temp[0].substring(1);
		originalAmount=parseFloat(withoutDollar)+parseFloat("15.00");//withoutDollar;
		var totalAmount=(parseFloat("15.00")+parseFloat(withoutDollar))*parseFloat(intQty);
		price="$"+totalAmount.toFixed(2);
		}
		else
		{
		price = temp[0].substring(1);
		
		originalAmount=price;
		price=trimString(price);
		price=parseFloat(price);
		
		price=price*parseFloat(intQty);
		
		price="$"+price;
		
		}
		
		
		userClickAmount=trimString(price);
		
		selectedArrivalDatePrice=trimString(price);
		
		if(toCheckMorningArrival()==0)
		{
			document.detail.price12.value=trimString(price);
		}
		else
		{
			if(id==1)
			{
				document.detail.price12.value=trimString(price);
			}
			else
			{
				price=toCheckMorningArrival().toFixed(2);
				price=parseFloat(price);
				price=price*parseFloat(intQty);		
				price="$"+price.toFixed(2);
				document.detail.price12.value=price;
			}	
		}
		 
		
		
		
		}

}

function populatePriceDate1(id) {
	var currentQTY;
	var intQty;
	if(document.getElementById('QTY')!=null)
	{
	 	currentQTY=document.getElementById('QTY').value;
		intQty=parseInt(currentQTY);	
	}
	else
	{
		if(document.getElementById('reviewQTYEdit')!=null)
		{
			currentQTY=document.getElementById('reviewQTYEdit').value;
			intQty=parseInt(currentQTY);	
		}
		else if(document.getElementById('ohQTYEdit')!=null)
		{
			//
			currentQTY=document.getElementById('ohQTYEdit').value;
			intQty=parseInt(currentQTY);
			//alert("intQty="+intQty);
			}
		
	}

if(top.document.detail.shipmethodoverride.length!=null)
{
for(i=0; i< top.document.detail.shipmethodoverride.length; i++)
{

if(top.document.detail.shipmethodoverride[i].disabled==true)
{

}
else
{
var pos=top.document.detail.shipmethodoverride[i].value;


var getValue=pos;
var amt;

if(getValue == 1)
amt = document.detail.SHIPMETHOD1.value;
if(getValue == 2)
amt = document.detail.SHIPMETHOD2.value;
if(getValue == 3)
amt = document.detail.SHIPMETHOD3.value;
if(getValue == 4)
amt = document.detail.SHIPMETHOD4.value;

//alert("amt="+amt);
var temp=new Array();
temp = amt.split(" ");
var price ;
if(id==1)
{
	var withoutDollar=temp[0].substring(1);
	var totalAmount=parseFloat("15.00")+parseFloat(withoutDollar);
	price="$"+totalAmount.toFixed(2);
}
else
{
price = temp[0];
}



var dateRange = amt.substring(price.length,amt.length);



document.detail.dateString.value=dateRange;

document.detail.price12.value=price;

break;
}
}
}

}

// Code for highlighting borders



 var box1=true;
		var box2=false;
		var box3=false;
		var box4=false;
		var box5=false;

	var step2Box1=true;
	var step2Box2=false;
	var step2Box3=false;
	

function step2Validation(currentId)
	{
		
		
		if(currentId=="paymentboxbg")
		{
			if(billingAddressValidaion122())
			{
				step2Box2=true;
				step2Box3=false;
				resetHighlightBox1();
				//document.getElementById(currentId).innerHTML=overHighlightBox();
				document.getElementById(currentId+"img").src="images/bg_table_over.gif";
			}
			
			
		}
		else if(currentId=="revieworderboxbg")
		{
		
			if(step2CreditCardValidation())
			{
				step2Box2=true;
				step2Box3=true;
				resetHighlightBox1();
				//document.getElementById(currentId).innerHTML=overHighlightBox();
				document.getElementById(currentId+"img").src="images/bg_table_over.gif";
			}
		}
		else
		{
		}
		
		

	}
function billingAddressValidaion122()
	{
			var fname = document.checkout.bfname.value;
			//alert(fname);
			var lname = document.checkout.blname.value;
			var cname = document.checkout.bcname.value;
			var addr1 = document.checkout.baddr1.value;
			var addr2 = document.checkout.baddr2.value;
			var zip = document.checkout.bzip.value;
			var city = document.checkout.bcity.value;
			//var state = document.checkout.state.value;
			var email = document.checkout.bemail.value;
			var country = document.checkout.country.value;
			/*
			var phonec1 = document.checkout.phone1.value;
			var phonec2 = document.checkout.phone2.value;
			var phonec3 = document.checkout.phone3.value;
			*/
			var checkUsCanada=false;
			var getStateStyle=document.getElementById('checkoutstate');
			
			if(getStateStyle!=null)
			{
				var getStateStyleStatus=document.getElementById('checkoutstate').style.display;

				if(getStateStyleStatus!='none')
				{
					state =document.checkout.bstate.value;
					checkUsCanada=true;

//alert("STATE="+state);
				}

			}
			
			
			//var phonec1 = phonec.substring(0, 3);
			//var phonec2 = phonec.substring(3, 6);
			//var phonec3 = phonec.substring(6, 10);
			//alert(country);
			
			if(fname.length<=0)
			{				
				return false;
			}
			else if(lname.length<=0)
			{
				return false;
			}		
			else if(addr1.length<=0)
			{
				return false;
			}			
			else if(zip.length<=0)
			{
				return false;
			}
			else if(city.length<=0)
			{
				return false;
			}
			/*
			else if(isInteger(phonec1)==false)
			{
				return false;
			}
			else if(isInteger(phonec2)==false)
			{
				return false;
			}
			else if(isInteger(phonec3)==false)
			{
				return false;
			}
			
			else if(phonec1.length>3 | phonec1.length<3)
			{			
				return false;
				
			}
			else if(phonec2.length>3 | phonec2.length<3)
			{
				return false;
			}
			else if(phonec3.length>4 | phonec3.length<4)
			{
				return false;
			}
			*/
			else if(email.length<=0)
			{
				return false;
			}
			else if(checkUsCanada)
			{
				if(state.length<=0)
					return false;
				else
					return true;

			}
			
			else
			{
				return true;
			}
			
	}


	function highlightBoxOver(boxId)
	{
		
		
	}

function resetHighlightBox()
{
	/*
	document.getElementById('arrivaldateboxbg').innerHTML=emptyHighlightBox();
	document.getElementById('giftmessageboxbg').innerHTML=emptyHighlightBox();
	document.getElementById('shippingaddressboxbg').innerHTML=emptyHighlightBox();
	*/
	document.getElementById('arrivaldateboxbgimg').src="images/bg_table.gif";
	document.getElementById('giftmessageboxbgimg').src="images/bg_table.gif";
	document.getElementById('shippingaddressboxbgimg').src="images/bg_table.gif";
}

function resetHighlightBox1()
{
	/*
	document.getElementById('billingaddressboxbg').innerHTML=emptyHighlightBox();
	document.getElementById('paymentboxbg').innerHTML=emptyHighlightBox();
	document.getElementById('revieworderboxbg').innerHTML=emptyHighlightBox();
	*/
	document.getElementById('billingaddressboxbgimg').src="images/bg_table.gif";
	document.getElementById('paymentboxbgimg').src="images/bg_table.gif";
	document.getElementById('revieworderboxbgimg').src="images/bg_table.gif";
}


function step2CreditCardValidation()
{
	
	var ccnum = document.checkout.ccnum.value;
	
	//alert("ccnum.length="+ccnum.length);
	
	if(ccnum.length<=0)
	{
		return false;
	}
	
	return true;
	
	
}

function emptyHighlightBox()
{
	var content="<img src='images/bg_table.gif'  border='0'>";
	return content;
}

function overHighlightBox()
{
	var content="<img src='images/bg_table_over.gif'  border='0'>";
	return content;
}

function resetBoxValue()
{
	box1=true;
	box2=false;
	box3=false;
	box4=false;
	box5=false;
	
	
	step2Box1=true;
 step2Box2=false;
 step2Box3=false;
}

function isInteger (s)
   {
      var i;

      if (isEmpty(s))
      if (isInteger.arguments.length == 1) return 0;
      else return (isInteger.arguments[1] == true);

      for (i = 0; i < s.length; i++)
      {
         var c = s.charAt(i);

         if (!isDigit(c)) return false;
      }

      return true;
   }

   function isEmpty(s)
   {
      return ((s == null) || (s.length == 0))
   }

   function isDigit (c)
   {
      return ((c >= "0") && (c <= "9"))
   }
  	




function step2BoxOver(id)
	{
		
		if(id=="billingaddressboxbg")
		{
			if(step2Box1==true)
			{
				resetHighlightBox1();
				//document.getElementById(id).innerHTML=overHighlightBox();
				document.getElementById(id+"img").src="images/bg_table_over.gif";
			}
		}
		
		if(id=="paymentboxbg")
		{
			if(step2Box2==true)
			{
				resetHighlightBox1();
				//document.getElementById(id).innerHTML=overHighlightBox();
				document.getElementById(id+"img").src="images/bg_table_over.gif";
			}
		}
		if(id=="revieworderboxbg")
		{
			if(step2Box3==true)
			{
				resetHighlightBox1();
				//document.getElementById(id).innerHTML=overHighlightBox();
				document.getElementById(id+"img").src="images/bg_table_over.gif";
			}
		}
		
	}
function shippingAddressValidation()
{
			
			//alert(1);
			var fname = document.detail.fname.value;
			//alert(2);
			var lname = document.detail.lname.value;
			var cname = document.detail.cname.value;
			var addr1 = document.detail.addr1.value;
			var addr2 = document.detail.addr2.value;
			var zip = document.detail.zip.value;
			var city = document.detail.city.value;
			var state = document.detail.state.value;
			var email = document.detail.email.value;
			/*							
			var phone1 = document.detail.phone1.value;
			var phone2 = document.detail.phone2.value;
			var phone3 = document.detail.phone3.value;
			*/
			
			if(fname.length<=0)
			{
				
				return false;
			}
			else if(lname.length<=0)
			{
				return false;
			}
		
			else if(addr1.length<=0)
			{
				return false;
			}
			
			else if(zip.length<=0)
			{
				return false;
			}
			else if(city.length<=0)
			{
				return false;
			}
			else if(state.length<=0)
			{
				return false;
			}
			
			else
			{
				return true;
			}
			
			
}







// End highlighting border code





function highlightBox(currentBoxId)
{
resetHighlightBox1();

if(currentBoxId=='shippingaddressboxbg')
{
resetHighlightBox();
//document.getElementById(currentBoxId).innerHTML=overHighlightBox();
document.getElementById(currentBoxId+"img").src="images/bg_table_over.gif";
}

if(currentBoxId=='arrivaldateboxbg')
{

if(shippingAddressValidation())
{
resetHighlightBox();
//document.getElementById(currentBoxId).innerHTML=overHighlightBox();
document.getElementById(currentBoxId+"img").src="images/bg_table_over.gif";
}

}

if(currentBoxId=='giftmessageboxbg')
{
	
if(shippingAddressValidation())
{
if(arrivalDateValidation())
{
resetHighlightBox();
//document.getElementById(currentBoxId).innerHTML=overHighlightBox();
document.getElementById(currentBoxId+"img").src="images/bg_table_over.gif";
}
else
{
resetHighlightBox();
//document.getElementById('arrivaldateboxbg').innerHTML=overHighlightBox();
document.getElementById('arrivaldateboxbgimg').src="images/bg_table_over.gif";
}
}
else
{
resetHighlightBox();
//document.getElementById('shippingaddressboxbg').innerHTML=overHighlightBox();
document.getElementById('shippingaddressboxbgimg').src="images/bg_table_over.gif";
}
}

}
// Step 2

function step2_highlightBox(step2CurrentBoxId)
{

if(document.getElementById('arrivaldateboxbg') !=null )
{
resetHighlightBox();
}

if(step2CurrentBoxId=='billingaddressboxbg')
{
if(billingAddressValidaion122())
{
step2ResetHighlightBox();


//document.getElementById(step2CurrentBoxId).innerHTML=overHighlightBox();
document.getElementById(step2CurrentBoxId + "img").src="images/bg_table_over.gif";

//document.getElementById('submitButt').style.display='inline';
//alert(document.getElementById('submitimage').innerHTML);



}
else
{
step2ResetHighlightBox();
//document.getElementById('billingaddressboxbg').innerHTML=overHighlightBox();
document.getElementById('billingaddressboxbgimg').src="images/bg_table_over.gif";
document.getElementById('submitimage').innerHTML=resetSubmitOrder();
}

}

if(step2CurrentBoxId=='paymentboxbg')
{
if(billingAddressValidaion122())
{
step2ResetHighlightBox();
//document.getElementById(step2CurrentBoxId).innerHTML=overHighlightBox();
document.getElementById(step2CurrentBoxId+"img").src="images/bg_table_over.gif";
document.getElementById('submitimage').innerHTML=resetSubmitOrder();
//document.getElementById('submitButtShow').style.display='none';
//document.getElementById('submitButt').style.display='inline';
}
else
{
step2ResetHighlightBox();
//document.getElementById('billingaddressboxbg').innerHTML=overHighlightBox();
document.getElementById('billingaddressboxbgimg').src="images/bg_table_over.gif";

//document.getElementById('submitButtShow').style.display="none";

//document.getElementById('submitButt').style.display='inline';
document.getElementById('submitimage').innerHTML=resetSubmitOrder();
}
}

if(step2CurrentBoxId=='revieworderboxbg')
{

if(billingAddressValidaion122())
{

if(step2CreditCardValidation())
{

step2ResetHighlightBox();
//document.getElementById(step2CurrentBoxId).innerHTML=overHighlightBox();
document.getElementById(step2CurrentBoxId+"img").src="images/bg_table_over.gif";
//

document.getElementById('submitimage').innerHTML=showSubmitOrder();


//document.getElementById('submitButtShow').style.display='inline';
//document.getElementById('submitButt').style.display='none';

}
else
{
	
step2ResetHighlightBox();
//document.getElementById('paymentboxbg').innerHTML=overHighlightBox();
document.getElementById('paymentboxbgimg').src="images/bg_table_over.gif";
document.getElementById('submitimage').innerHTML=resetSubmitOrder();
//document.getElementById('submitButtShow').style.display='none';
//document.getElementById('submitButt').style.display='inline';
}
}
else
{

step2ResetHighlightBox();
//document.getElementById('billingaddressboxbg').innerHTML=overHighlightBox();
document.getElementById('billingaddressboxbgimg').src="images/bg_table_over.gif";
document.getElementById('submitimage').innerHTML=resetSubmitOrder();
//document.getElementById('submitButtShow').style.display='none';
//document.getElementById('submitButt').style.display='inline';
}
}



}



function step2ResetHighlightBox()
{
//document.getElementById('arrivaldateboxbg').innerHTML=emptyHighlightBox();
//document.getElementById('giftmessageboxbg').innerHTML=emptyHighlightBox();
//document.getElementById('shippingaddressboxbg').innerHTML=emptyHighlightBox();
/*
document.getElementById('billingaddressboxbg').innerHTML=emptyHighlightBox();
document.getElementById('paymentboxbg').innerHTML=emptyHighlightBox();
document.getElementById('revieworderboxbg').innerHTML=emptyHighlightBox();
*/
document.getElementById('billingaddressboxbgimg').src="images/bg_table.gif";
document.getElementById('paymentboxbgimg').src="images/bg_table.gif";
document.getElementById('revieworderboxbgimg').src="images/bg_table.gif";
}

function arrivalDateValidation()
{
//alert("hai");
//alert("document.detail.shipmethodoverride.length="+document.detail.arrivaloption.length);
for(i=0; i< document.detail.arrivaloption.length; i++)
{

//alert("i"+i);
//alert(document.detail.arrivaloption[i].checked);

if(document.detail.arrivaloption[i].checked == true)
{

if(document.detail.arrivaloption[i].value=="3")
{

var readUserSelectedDate=document.detail.price12.value;
var readUserSelectPrice=document.detail.dateString.value;
//alert(readUserSelectedDate);
if(readUserSelectedDate!="" && readUserSelectPrice!="")
{
if(trimString(readUserSelectedDate).length>0)
{
if(trimString(readUserSelectPrice).length>0)
{
return true;
break;
}
return false;
break;
}
else
{
return false;
break;
}
}
else
{
return false;
break;
}
}

return true;
break;
}


}
return false;
}

function showSubmitOrder()
{
	var con="<img src='/images/dd_submitorder.jpg' alt='Submit Order' title='Submit Order' border='0' onclick='saveBillingInfo()' style= 'cursor: pointer;' />";
	return con;
}
function resetSubmitOrder()
{
	var con="<img src='/images/dd_submitorder_grey.jpg' alt='Submit Order' title='Submit Order' border='0'  />";
	return con;
}


function showPrice(id)
{
	var currentQTY;
	var intQty;
	if(document.getElementById('QTY')!=null)
	{
	 	currentQTY=document.getElementById('QTY').value;
		intQty=parseInt(currentQTY);	
	}
	else
	{
		if(document.getElementById('reviewQTYEdit')!=null)
		{
			currentQTY=document.getElementById('reviewQTYEdit').value;
			intQty=parseInt(currentQTY);	
		}
		else if(document.getElementById('ohQTYEdit')!=null)
		{
			//
			currentQTY=document.getElementById('ohQTYEdit').value;
			intQty=parseInt(currentQTY);
			//alert("intQty="+intQty);
			}
		
	}
		
	
	var checkSelectStatus=0;

	if(top.document.detail.shipmethodoverride.length!=null)
	{
		for(i=0; i< top.document.detail.shipmethodoverride.length; i++)
		{

			if(top.document.detail.shipmethodoverride[i].disabled==true)
			{
//alert(i + " disabled");
			}
			else
			{

				checkSelectStatus=1;
//userSelectMethod=i;
			var pos=top.document.detail.shipmethodoverride[i].value;

//userSelectMethod=pos;
			var getValue=pos;
			top.document.detail.shipmethodoverride[i].checked = true;
//alert("Method: " + top.document.detail.shipmethodoverride[i].value);
			var amt;

if(getValue == 1)
amt = document.detail.SHIPMETHOD1.value;
if(getValue == 2)
amt = document.detail.SHIPMETHOD2.value;
if(getValue == 3)
amt = document.detail.SHIPMETHOD3.value;
if(getValue == 4)
amt = document.detail.SHIPMETHOD4.value;
if(getValue == 5)
amt = document.detail.SHIPMETHOD5.value;
if(getValue == 6)
amt = document.detail.SHIPMETHOD6.value;
if(getValue == 7)
amt = document.detail.SHIPMETHOD7.value;


//alert("amt="+amt);
var temp=new Array();
temp = amt.split(" ");
var price ;
if(id==1)
{
var withoutDollar=temp[0].substring(1);
var totalAmount=(parseFloat("15.00")+parseFloat(withoutDollar))*parseFloat(intQty) ;

price="$"+totalAmount.toFixed(2);
//alert("price="+price);
}
else
{
price = temp[0].substring(1);
price=trimString(price);
price=parseFloat(price);

price=price*parseFloat(intQty);
price=price.toFixed(2);
//alert("price="+price);
price="$"+price;
}



//var dateRange = dayofweeek+" "+da;//amt.substring(price.length,amt.length); da,dayofweeek


//alert("dateRange: " + dateRange + " price: " + price);
//document.forms[0].dateString.value=trimString(dateRange);

//userClickAmount=trimString(price);

if(toCheckMorningArrival()==0)
{
	document.detail.price12.value=trimString(price);
}
else
{
	if(id==1)
	{
		document.detail.price12.value=trimString(price);
	}
	else
	{
		price=toCheckMorningArrival();
		//alert("price="+price);
		price=parseFloat(price);
		price=price*parseFloat(intQty);		
		price="$"+price.toFixed(2);
		
		document.detail.price12.value=price;
	}	
}

break;
}
}
}

//alert("checkSelectStatus="+checkSelectStatus);
	
	
}




function toCheckMorningArrival()
	{
		var getMorningArrivalStatus=document.getElementById('overnightamfuturenew').checked;
		var amt=0;
		var price;
		if(getMorningArrivalStatus)
		{
			var amt = document.detail.SHIPMETHOD4.value;
			
			var temp=new Array();
			temp = amt.split(" ");
			price = temp[0].substring(1);
			price=trimString(price);
			price=parseFloat(price);
		
			if ( ! isSat )
			{	
				var intQty=parseInt(getQuantity());
				price += ( 5 * intQty );
			}
			
			return price;
		}
		else
			return amt;
		
		
	}


	function shipNowMorningArrival() {
	  var getMorningArrivalStatus=document.getElementById('overnightamnew').checked;
		var amt=0;
		var price;
		var intQty=parseInt(getQuantity());
		
		var addMorningArrivalAmount=5;
		
		if(getMorningArrivalStatus)
		{
			
			var amt = document.detail.SHIPMETHOD4.value;
			
			var temp=new Array();
			temp = amt.split(" ");
			price = temp[0].substring(1);
			price=trimString(price);
			price=parseFloat(price);
			price=price.toFixed(2);
			price=price*intQty;
			price=price+(addMorningArrivalAmount*intQty);
			price="$"+price.toFixed(2);
			document.detail.price11.value=price;
			
			
		}
		else
		{
			
			var amt = document.detail.SHIPMETHOD4.value;
			var temp=new Array();
			temp = amt.split(" ");
			price = temp[0].substring(1);
			price=trimString(price);
			price=parseFloat(price);
			price=price.toFixed(2);
			price=price*intQty;
			//price=price+addMorningArrivalAmount;
			price="$"+price.toFixed(2);
			document.detail.price11.value=price;
			
			
		}
	}
	

	function _toCheckMorningArrival()
	{
		var getMorningArrivalStatus=document.getElementById('overnightamfuturenew').checked;
		var amt=0;
		var price;
		var intQty=parseInt(getQuantity());
		var addMorningArrivalAmount=5;
		if(getMorningArrivalStatus)
		{
			var amt = document.detail.SHIPMETHOD4.value;
			
			var temp=new Array();
			temp = amt.split(" ");
			price = temp[0].substring(1);
			price=trimString(price);
			price=parseFloat(price);
			price=price.toFixed(2);
			price=price*intQty;
			price=price+(addMorningArrivalAmount*intQty);
			price="$"+price.toFixed(2);
			document.detail.price12.value=price;
			
			
		}
		else
		{
			document.detail.price12.value=userClickAmount;
			if(top.document.detail.shipmethodoverride.length!=null)
			{
				for(i=0; i< top.document.detail.shipmethodoverride.length; i++)
				{
								
					
					
				/*	if(amount==selectedArrivalDatePrice)
					{
						alert("woh true");
					}
				*/
					getValue=top.document.detail.shipmethodoverride[i].value;
					if(getValue == 1)
					{
						var temp= new Array();
						temp=document.detail.SHIPMETHOD1.value.split(' ');					
						var amount=temp[0].substring(1);				
						amount=parseFloat(amount);
						amount=amount*intQty;				
						amount="$"+amount.toFixed(2);
						if(amount==selectedArrivalDatePrice)
						{
							top.document.detail.shipmethodoverride[i].checked=true;
							break;
						}
					}
					if(getValue == 2)
					{
						var temp= new Array();
						temp=document.detail.SHIPMETHOD2.value.split(' ');					
						var amount=temp[0].substring(1);				
						amount=parseFloat(amount);
						amount=amount*intQty;						
						amount="$"+amount.toFixed(2);
						if(amount==selectedArrivalDatePrice)
						{
							top.document.detail.shipmethodoverride[i].checked=true;
							break;
						}
					}
					if(getValue == 3)
					{
						var temp= new Array();
						temp=document.detail.SHIPMETHOD3.value.split(' ');					
						var amount=temp[0].substring(1);				
						amount=parseFloat(amount);
						amount=amount*intQty;										
						amount="$"+amount.toFixed(2);
						if(amount==selectedArrivalDatePrice)
						{
							top.document.detail.shipmethodoverride[i].checked=true;
							break;
						}
					}
					if(getValue == 4)
					{
						var temp= new Array();
						temp=document.detail.SHIPMETHOD4.value.split(' ');					
						var amount=temp[0].substring(1);				
						amount=parseFloat(amount);	
						amount=amount*intQty;									
						amount="$"+amount.toFixed(2);
						if(amount==selectedArrivalDatePrice)
						{
							top.document.detail.shipmethodoverride[i].checked=true;
							break;
						}
					}
					
				}
			}	
			
			
		}
		
	}



		function getQuantity()
		{
			var currentQTY;

					if(document.getElementById('QTY')!=null || document.getElementById('QTY')!=undefined)
					{
						
						if(document.getElementById('QTY').length > 0)
						currentQTY=document.getElementById('QTY').value;
					}
					else if(document.detail.reviewQTYEdit!=null)
					{
						
						
						currentQTY=document.detail.reviewQTYEdit.value;
						
					
					}
					else if(document.getElementById('ohQTYEdit')!=null)
					{
					//if(document.getElementById('ohQTYEdit').length>0)
					//{
						
					currentQTY=document.getElementById('ohQTYEdit').value;
					//}
					}
					
					return currentQTY;
		}










		function checkCountry(cid) {
		
			if(cid!=229 && cid != 37) {
				hide("checkoutstate");
			}
			else {
				show("checkoutstate");
			}
		
		}
		
		function updateuscitystate(v, zip) {
			if(v.length > 0 && v == 229 && zip.length > 0) {
	        	updatecitystate(zip, 2); 
			}
		}
		
		var recipientId = 0;
		function pullRecipientEmail(recipientId) {
			if ( giftRecipients != null )
			{
				document.getElementById("recipientEmail").value = giftRecipients[recipientId] + "'s email";
			}
		}
		
		
		function addRecipientEmail() {
		
			var emailID=document.checkout.recipientEmail;
		
			if ((emailID.value==null)||(emailID.value=="")){
				alert("please enter email");
				emailID.focus();
				return false;
			}
			if (echeck(emailID.value)==false){
				emailID.value="";
				emailID.focus();
				return false;
			}
		
			var xmlHttp;
			try
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
			}
			catch (e)
			{
				// Internet Explorer
				try
				{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					try
					{
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e)
					{
						alert("Your browser does not support AJAX!");
						return false;
					}
				}
			}
				
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==4)
				{
					var result = xmlHttp.responseText;
					if(result = "success") {
						recipientId ++;
						if(recipientId < recpCount) {
							pullRecipientEmail(recipientId);
						}
						else {
							hidediv("emailtext");
							showdiv("thankstext");
						}
					}
				}
			}
				
			var firstName = giftRecipientsFN[recipientId];
			var lastName = giftRecipientsLN[recipientId];
			var email = document.checkout.recipientEmail.value;
			var arrivalDate = giftRecipientsAD[recipientId];
			var productId = giftRecipientsID[recipientId];
			var productName = giftRecipientsIN[recipientId];
			var orderDateTime = giftRecipientsOT[0];
			var orderNumber = giftRecipientsON[0];
			var recipientRollNo = recipientId + 1;
			var recipientCount = recpCount;
			
			var URL = "/eoneCommerce/ExcelGenerator?billingName="+escape(billingName)+"&firstName="+escape(firstName)+"&lastName="+escape(lastName)+"&email="+email+"&arrivalDate="+arrivalDate+"&productId="+productId+"&productName="+escape(productName)+"&orderDateTime="+orderDateTime+"&orderNumber="+orderNumber+"&recipientRollNo="+recipientRollNo+"&recipientCount="+recipientCount;
			
			if (navigator.userAgent.indexOf('googlebot') > -1)
			{
				document.write ( URL );
			}
			xmlHttp.open("GET", URL, true);
			xmlHttp.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
			xmlHttp.setRequestHeader("Cache-Control", "no-cache");
			xmlHttp.send(null);
		
		}
		
		
		function addRecipient(firstname, lastname, el) {
		
		if(el.checked) {	
			var fn = document.detail.nrfn;
			var ln = document.detail.nrln;
			var fn1 = document.detail.nrfn1;
			var ln1 = document.detail.nrln1;
			var fn2 = document.detail.nrfn2;
			var ln2 = document.detail.nrln2;
			var fn3 = document.detail.nrfn3;
			var ln3 = document.detail.nrln3;
			var fn4 = document.detail.nrfn4;
			var ln4 = document.detail.nrln4;
			var fn5 = document.detail.nrfn5;
			var ln5 = document.detail.nrln5;
			var fn6 = document.detail.nrfn6;
			var ln6 = document.detail.nrln6;
			var fn7 = document.detail.nrfn7;
			var ln7 = document.detail.nrln7;
			var fn8 = document.detail.nrfn8;
			var ln8 = document.detail.nrln8;
			var fn9 = document.detail.nrfn9;
			var ln9 = document.detail.nrln9;
			
			var sfn = trimString(fn.value);
			var sln = trimString(ln.value);
			var sfn1 = trimString(fn1.value);
			var sln1 = trimString(ln1.value);
			var sfn2 = trimString(fn2.value);
			var sln2 = trimString(ln2.value);
			var sfn3 = trimString(fn3.value);
			var sln3 = trimString(ln3.value);
			var sfn4 = trimString(fn4.value);
			var sln4 = trimString(ln4.value);
			var sfn5 = trimString(fn5.value);
			var sln5 = trimString(ln5.value);
			var sfn6 = trimString(fn6.value);
			var sln6 = trimString(ln6.value);
			var sfn7 = trimString(fn7.value);
			var sln7 = trimString(ln7.value);
			var sfn8 = trimString(fn8.value);
			var sln8 = trimString(ln8.value);
			var sfn9 = trimString(fn9.value);
			var sln9 = trimString(ln9.value);
			
			if(sfn.length == 0 && sln.length == 0) {
				fn.value = firstname;
				ln.value = lastname;
			}
			else if(sfn1.length == 0 && sln1.length == 0) {
				fn1.value = firstname;
				ln1.value = lastname;
				showdiv('2divRecievers');
			}
			else if(sfn2.length == 0 && sln2.length == 0) {
				fn2.value = firstname;
				ln2.value = lastname;
				showdiv('3divRecievers');
			}
			else if(sfn3.length == 0 && sln3.length == 0) {
				fn3.value = firstname;
				ln3.value = lastname;
				showdiv('4divRecievers');
			}
			else if(sfn4.length == 0 && sln4.length == 0) {
				fn4.value = firstname;
				ln4.value = lastname;
				showdiv('5divRecievers');
			}
			else if(sfn5.length == 0 && sln5.length == 0) {
				fn5.value = firstname;
				ln5.value = lastname;
				showdiv('6divRecievers');
			}
			else if(sfn6.length == 0 && sln6.length == 0) {
				fn6.value = firstname;
				ln6.value = lastname;
				showdiv('7divRecievers');
			}
			else if(sfn7.length == 0 && sln7.length == 0) {
				fn7.value = firstname;
				ln7.value = lastname;
				showdiv('8divRecievers');
			}
			else if(sfn8.length == 0 && sln8.length == 0) {
				fn8.value = firstname;
				ln8.value = lastname;
				showdiv('9divRecievers');
			}
			else if(sfn9.length == 0 && sln9.length == 0) {
				fn9.value = firstname;
				ln9.value = lastname;
				showdiv('10divRecievers');
				showdiv('orderingmore');
				hidediv('showoption');
				hidediv('hideoption')
			}
			else {
				alert("Maximum recipients reached already");
			}
		}	
		}
		

		function echeck(str) {
		
			var at="@";
			var dot=".";
			var lat=str.indexOf(at);
			var lstr=str.length;
			var ldot=str.indexOf(dot);
			if (str.indexOf(at)==-1){
			   alert("please enter valid email");
			   return false;
			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   alert("please enter valid email");
			   return false;
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			    alert("please enter valid email");
			    return false;
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
			    alert("please enter valid email");
			    return false;
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			    alert("please enter valid email");
			    return false;
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
			    alert("please enter valid email");
			    return false;
			 }
			
			 if (str.indexOf(" ")!=-1){
			    alert("please enter valid email");
			    return false;
			 }
	
	 		 return true;					
		 }

