// JavaScript Document
/* var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
 if(mine)
    var popUpsBlocked = false
 else
    var popUpsBlocked = true

//alert(popUpsBlocked);

if(popUpsBlocked)
  alert('We have detected that you are using popup blocking software.');
else
	mine.close();
*/	
function callPage(val)
{
	window.location.href	= "destination/"+val;
}

function ChangeImg_over(val)
{
	if (val == 1)
		document.homeImg.src= "images/reserve_fn.jpg";
	else
		document.homeImg.src= "images/reserve_en.jpg";
}

function ChangeImg_out(val)
{
	if (val == 1)
		document.homeImg.src= "images/reserve_f.jpg";
	else
		document.homeImg.src= "images/reserve_e.jpg";
}

function bookmarkme()
{
	var txt = "Bookmark Us!";
	var url = this.location.href;
	var who = "Naturalgiftsathome.co.uk";

	var ver = navigator.appName;
	var num = parseInt(navigator.appVersion);
	if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) 
	{
		window.external.AddFavorite(url,who);
	}
	else
	{
		txt = "Press (Ctrl+D) to Add to favorite!";
		alert(txt);
	}
}

function mycenteralpopwinVHS(fname,width,height)
{
	var file
	var sWidth	= 200
	var sHeight = 200
	
	if(width.length > 0)
	{
		sWidth = width;
	}
	else
	{
		width =100;
	}
	
	if(height.length > 0)
	{
		sHeight = height;
	}
	else
	{
		height =100;
	}
	
	file = fname
	file =file	
	
	var wintop  =window.screen.availHeight;
	var winleft =window.screen.availWidth;
	wintop  =(wintop/2) -(height/2)
	winleft =(winleft/2) -(width/2)
	//wintop  = 0
	//winleft = 0
	
	if ( sWidth > window.screen.availWidth )
		{ sWidth = window.screen.availWidth; }
	if (sHeight > window.screen.availHeight )
		{ sHeight = window.screen.availHeight; }
	if ( parseInt(sWidth) < width )
		{ sWidth = width; }
	if ( parseInt(sHeight) < height )
		{ sHeight = height; }
	
	if ( navigator.appName == "Microsoft Internet Explorer" )
		{ window.open(file, "_blank", "status=no, scrollbars=yes, toolbar=no, resizable=yes, location=no, menubar=no, top=" + wintop + ", left= "+ winleft +", height=" + sHeight + ", width=" + sWidth); 
		}
	if ( navigator.appName == "Netscape" ) 
		{ 
		window.open(file,"_blank","scrollbars=yes,alwaysRaised,resizable=yes,dependant,innerheight=" + sHeight + ",innerwidth=" + sWidth); 		 
		//window.open(file,"_blank","alwaysRaised,dependant,scrollbars=yes,innerheight=" + sHeight + ",innerwidth=" + sWidth); 
		}
}

 function checkEmpty(frm)
	{
		if(frmPartner.txtUID.value == '')
		{
			alert('Please enter email address.');
			document.frmPartner.txtUID.focus();
			 return false; 
		}	
		else
		{
			var str=frmPartner.txtUID.value;
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (filter.test(str))
			{
			}
			else
			{
				alert("Please enter a valid email address!")
				return false; 
			}
		}
		if(frmPartner.txtPWD.value == '')
		{
			alert('Please enter password.');
			document.frmPartner.txtPWD.focus();
			return false; 
		}	
		return true;
	}
	

function verifyNumeric(which)
{
	var oldvalue = [''];
    if (isNaN(which.value))
    {
        if (oldvalue[which])
        {
            which.value = oldvalue[which];
        }
        else
        {
            which.value = '';
            oldvalue[which] = '';
        }    
    }
    else
    {
        oldvalue[which] = which.value;
    }
}


function validation()
{
 	var n1 = 0;
	var e1 = 0;
	if(document.frmNews.txtName.value == "")
	{
		alert("Please Enter Name...");	
		document.frmNews.txtName.focus();	
		return false;
		
	}
	else
	{
		r1 = 1;		
	}

	if(document.frmNews.txtEmail.value == "")
	{
		alert("Please Enter Email...");			
		document.frmNews.txtEmail.focus();	
		return false;
	}
	else
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frmNews.txtEmail.value)){
		e1 = 1;	
		return (true);
		}
		else
		{
			alert("Invalid E-mail Address! Please re-enter.")
			return (false);
		}
		
	}	
	if(r1 == 1 && e1 == 1)
	{
		document.frmNews.submit();
	}	
	
}
 
function FillValues(frm)
{
	if (frm.chkFillHolder.checked)
	{
		frm.txtFName_B.value	= frm.txtFName_D.value;
		frm.txtLName_B.value	= frm.txtLName_D.value;
		frm.txtEmail_B.value	= frm.txtEmail_D.value;
		frm.txtAddress_B.value	= frm.txtAddress_D.value;
		frm.selState_B.value	= frm.selState_D.value;
		frm.txtPostCode_B.value	= frm.txtPostCode_D.value;
		frm.selCountry_B.value	= frm.selCountry_D.value;
		frm.txtPhone_B.value	= frm.txtPhone_D.value;
	}
	else
	{
		frm.txtFName_B.value	= "";
		frm.txtLName_B.value	= "";
		frm.txtEmail_B.value	= "";
		frm.txtAddress_B.value	= "";
		frm.selState_B.value	= "";
		frm.txtPostCode_B.value	= "";
		frm.selCountry_B.value	= "";
		frm.txtPhone_B.value	= "";
	}	
		
}

function displayBilling(val)
{
	var idPmtMethod		= val;
	var idPmtTr			= document.getElementById("idPmtTr");
	var idPmtT1			= document.getElementById("idPmtTr1");
	
	if (idPmtMethod == 3)
	{
		idPmtTr.style.display 		= "block";
		idPmtTr1.style.display 		= "block";
	}	
	else
	{
		idPmtTr.style.display 		= "none";
		idPmtTr1.style.display 		= "none";
	}
}

function CallSecurity(val)
{
	if (val == "Amex")
		document.all.CCsec.innerHTML = "(4 Digits above your account number on the front side)";
	else
		document.all.CCsec.innerHTML = "(Last 3 digits above signature at the back of your card)";
}

function CntryOthr(val)
{
	var idCountry		= document.getElementById("idCntry");
	
	if (val == " Others")
		idCountry.style.display = "block";
	else
		idCountry.style.display = "none";
}
