//
function getWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	return myWidth;
}
function getHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	return myHeight;
}
//

// To break out of frames
if (window != top) top.location.href = location.href;
// 
// DISABLES RIGHT CLICKS IN IE AND NS
function click(e){
if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2)||navigator.appName == 'Netscape' && (e.which == 3)){
alert('Copyrighted Images.');
 }
}
if (document.layers) document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=click;
document.onMousedown=click;

//
function validateForm(what) {
var notvalid=0;
    for (var i = 0; i<what.elements.length; i++) {
    
if (what.elements[i].value == "" && (what.elements[i].name != "message"&& what.elements[i].name != "Wedding Budget")){alert('Please enter\n'+   what.elements[i].name);notvalid=1;}
			if (what.elements[i].value=="Daytime Phone Number"){alert('Please enter a Daytime Number you can be directly reached at.');notvalid=1;}
		   	}
	if (notvalid !=0){
	return false;
	}else return true;
}
//

// phone

function validatePhone(string) {
    //if (!string) return false;
   var Chars = "0123456789.-() ";
    
    // check for allowed characters
    for (var i = 0; i < string.length; i++) {
           if (Chars.indexOf(string.charAt(i)) == -1)
           {alert ("Please correct your Daytime Phone Number");
           document.forms[0].phone.select();
           return false;}
    }
    
    // Count the numbers  if(string.charAt(i).match(numericExpression)
    	
    	var Digit=0;
    	var numericExpression = /^[0-9]+$/;
    	   
    	   for (i = 0; i < string.length; i++)
    	    {   
    	       if(string.charAt(i).match(numericExpression)) {Digit++;}
    	    }
    	    // if there are not 10 numbers.
    	    
    	   if (Digit >0 && Digit!=10) {alert ("Some Numbers Are Missing in your Daytime Phone Number");
	   document.forms[0].phone.select();
	     return false;}
  	
  return true;
}
//

//
function validateEmail(string) {
    if (!string) return false;
    invalidChars = " /:,;";

    for (var i = 0; i < invalidChars.length; i++) {
	badChar=invalidChars.charAt(i)
       if (string.indexOf(badChar,0) >-1)
          return false;
    }
	atPos=string.indexOf("@",1)//check for at sign
	if(atPos==-1) {return false}

	periodPos=string.indexOf(".",atPos)//period after at sign
	if(periodPos == -1) {return false}

	if (periodPos+3 > string.length) {return false}// min 2 spaces after period


    return true;
}
//
function validateZip(string) {// 5 digit
    if (!string) return false;
    var Chars = "0123456789";
	
	if (string.length!=5)return false;
	
    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1)
          return false;
   }
   return true;
}

// place cookies

// place cookies

function setCookie(){
//end=new Date().getTime();
today=new Date();
millisecs_in_day=86400000;
millisecs_in_14days=14*millisecs_in_day;
page=document.URL.substring(document.URL.indexOf('gemasana.com/')+13,document.URL.length);
expireDate = new Date(today.getTime() + millisecs_in_14days);
document.cookie=page+"="+((today.getTime()-start)/1000)/60+";path=/;expires="+expireDate.toGMTString();
}

start=new Date().getTime();


