// JavaScript Document

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return (false);
    }
    // All characters are numbers.
    return (true);
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length == minDigitsInIPhoneNumber);
}


function validate()
{


	if (document.form1.name.value.length == 0)
    {
        alert("Please Enter Your First and Last Name ");
        document.form1.name.focus();
        return (false);
    }


    var Phone=document.form1.phone

	if ((Phone.value==null)||(Phone.value==""))
	{
		alert("Please Enter a Phone Number");
		Phone.focus();
		return (false);
	}

	if (checkInternationalPhone(Phone.value)==false){
		alert("Please Enter a Valid Phone Number");
		Phone.value="" ;
		Phone.focus();
		return (false);
	}

  
  if (document.form1.contactEmail.value.indexOf("@") == -1 || document.form1.contactEmail.value== "")
    {
        alert("Please Enter a Valid E-mail Address");
        document.form1.contactEmail.focus();
        return (false);
    }
  

    if (document.form1.on_off_hold.selectedIndex <= 0)
    {
        alert("Please Select On or Off Hold");
        document.form1.on_off_hold.focus();
        return (false);
    }

	if (document.form1.date.value.length == 0)
	{
		alert("Please Select Date");
		document.form1.date.focus();
		return (false);
    }

	if (document.form1.sID.value.length == 0)
	{
		alert("Please Enter Your Site Id");
		document.form1.sID.focus();
		return (false);
    }

	if (document.form1.sanPin.value.length == 0)
    {
        alert("Please Enter Your San Number");
        document.form1.sanPin.focus();
        return (false);
    }

	document.form1.action = "./thankyou-seasonal.php";
	document.form1.submit();
	window.open("thankyou-seasonalhold.html", "Thank You!!","status = 1, height = 300, width = 300, resizable = 0, left=450, top=250")

}



function togglec1(){ 
document.getElementById('c1').style.display="block"; // defult open the first tab 
document.getElementById('c2').style.display="none"; // collapse list 
document.getElementById('c3').style.display="none"; // collapse list 
document.getElementById('c4').style.display="none"; // collapse list 
document.getElementById('TabbedPanels1').style.backgroundImage = 'url(cmsimages/tab-back1.gif)';

} 

function togglec2(){ 
document.getElementById('c2').style.display="block"; // defult open the first tab 
document.getElementById('c1').style.display="none"; // collapse list 
document.getElementById('c3').style.display="none"; // collapse list 
document.getElementById('c4').style.display="none"; // collapse list 
document.getElementById('TabbedPanels1').style.backgroundImage = 'url(cmsimages/tab-back2.gif)';

} 

function togglec3(){ 
document.getElementById('c3').style.display="block"; // defult open the first tab 
document.getElementById('c2').style.display="none"; // collapse list 
document.getElementById('c1').style.display="none"; // collapse list 
document.getElementById('c4').style.display="none"; // collapse list 
document.getElementById('TabbedPanels1').style.backgroundImage = 'url(cmsimages/tab-back3.gif)';
} 

function togglec4(){ 
document.getElementById('c4').style.display="block"; // defult open the first tab 
document.getElementById('c2').style.display="none"; // collapse list 
document.getElementById('c3').style.display="none"; // collapse list 
document.getElementById('c1').style.display="none"; // collapse list 
document.getElementById('TabbedPanels1').style.backgroundImage = 'url(cmsimages/tab-back4.gif)';
} 

function togglecVideo(){ 
document.getElementById('video').style.display="block"; // defult open the first tab 
} 

function closeVideo(){ 
document.getElementById('video').style.display="none"; // defult open the first tab 
	if (navigator.appName == 'Microsoft Internet Explorer'){
	
		window.location.reload();
	}
} 

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=634');");
}