/*----------------------------------------------------------------------------------
//Function Name: text messages
//Purpose: Function to get wufoo form for text messages
//Created Date: 14-Jun-10
//Modification History:
//	Date		Modification Details
//	
//
/*----------------------------------------------------------------------------------*/
var sms=0;
function textmessage(){
var sms=1;
//alert(sms);
//location.href='newsletter.php?sms='+sms;
	if(document.getElementById("flash")){
	  document.getElementById("flash").style.visibility='hidden';
	}
	
	var str = '<iframe height="871x" width="420px" allowTransparency="true" frameborder="0" scrolling="no" style="border:none"  src="newsletter.php?sms=1"></iframe>'; //'fname='+var_fname + '&lname=' + var_lname + '&email=' + var_email + '&zip=' +var_zip '\">;	
	//alert(str);
	var msgw,msgh,bordercolor; 
	msgw=450;//Width
	msgh=921;//Height 
   titleheight=25 //title Height
   bordercolor="#DEDEDE";//boder color
   titlecolor="#99CCFF";//title color
   //Get the actual body height / width to set the width of the overlay background
   var sWidth,sHeight; 
	if (typeof(document.body.offsetWidth) == 'number'){
	   sWidth=document.body.offsetWidth; 
	   sHeight=document.body.offsetHeight; 
	}
	if (typeof(document.body.clientHeight) == 'number'){
	   sWidth=document.body.clientWidth; 
	   sHeight=document.body.clientHeight; 
	}
	var totalHeight = document.documentElement.scrollTop + msgh;
	if(sHeight < totalHeight){
		sHeight = totalHeight +100;
	}
	
	//Specify the attributes (opacity etc.) for the background of the overlay
	var bgObj=document.createElement("div"); 
    bgObj.setAttribute('id','bgDiv'); 
    bgObj.style.position="absolute"; 
    bgObj.style.top="0"; 
    bgObj.style.background="#000"; 
    bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
    bgObj.style.opacity="0.8"; 
    bgObj.style.left="0"; 
   bgObj.style.width=sWidth + "px"; 
   bgObj.style.height=sHeight + "px"; 
   bgObj.style.zIndex = "10000"; 
   bgObj.style.overflowY = "auto"; 
   document.body.appendChild(bgObj); 
   //Create the Overlay Element and specify the overlay attributes  
   var msgObj=document.createElement("div") 
   msgObj.setAttribute("id","msgDiv"); 
   msgObj.setAttribute("align","center"); 
   msgObj.style.background="white"; 
   msgObj.style.border="1px solid " + bordercolor; 
   msgObj.style.position = "absolute"; 
   msgObj.style.left = "50%"; 
   msgObj.style.top = "15%"; 
   msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   msgObj.style.marginLeft = "-225px" ; 
   if(document.documentElement.scrollTop !=0){
   msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; 
   }
   else{
   msgObj.style.marginTop= -75+ document.body.scrollTop +"px";
   }
   msgObj.style.width = msgw + "px"; 
   msgObj.style.height =msgh + "px"; 
   msgObj.style.textAlign = "center"; 
   msgObj.style.lineHeight ="25px"; 
   msgObj.style.zIndex = "10001"; 
   //Create the Overlay Title and specify the  attributes 
   var title=document.createElement("h4"); 
   title.setAttribute("id","msgTitle"); 
   title.style.margin="0"; 
   title.style.padding="3px"; 
   title.style.background=bordercolor; 
   title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
   title.style.opacity="0.75"; 
   title.style.border="1px solid " + bordercolor; 
   title.style.height="18px"; 
   title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   title.style.fontWeight="Bold"; 
   title.style.color="#404040"; 
   title.style.cursor="pointer"; 
   title.innerHTML="<table width='100%'><tr><td align='left'><div align='left'><b>Stay Informed</b></div></td><td align='right'><b>Close</b></td></tr></table>"; 
   //Function for the actions to be done when the overlay is closed 
   title.onclick=function(){ 
          document.body.removeChild(bgObj); 
          document.getElementById("msgDiv").removeChild(title); 
          document.body.removeChild(msgObj); 
		  if(document.getElementById("flash")){
			document.getElementById("flash").style.visibility='visible';
			}
		  
        } 
    //Load the required contents into the overlay
   document.body.appendChild(msgObj); 
   document.getElementById("msgDiv").appendChild(title); 
   var txt=document.createElement("p"); 
   txt.style.margin="1em 0" 
   txt.setAttribute("id","msgTxt"); 
   txt.innerHTML=str; 
   document.getElementById("msgDiv").appendChild(txt); 

}

function newsletter(){
	if(document.getElementById("flash")){
	  document.getElementById("flash").style.visibility='hidden';
	}
	var var_fname=document.getElementById('fname').value;
	var var_lname=document.getElementById('lname').value;
	var var_email=document.getElementById('email').value;
	var var_zip=document.getElementById('zip').value;
	var str = '<iframe height="871x" width="420px" allowTransparency="true" frameborder="0" scrolling="no" style="border:none"  src="newsletter.php?fname=' + var_fname + '&lname=' + var_lname + '&email=' + var_email + '&zip=' + var_zip + '"></iframe>'; //'fname='+var_fname + '&lname=' + var_lname + '&email=' + var_email + '&zip=' +var_zip '\">;	
	var msgw,msgh,bordercolor; 
	msgw=450;//Width
	msgh=921;//Height 
   titleheight=25 //title Height
   bordercolor="#DEDEDE";//boder color
   titlecolor="#99CCFF";//title color
   //Get the actual body height / width to set the width of the overlay background
   var sWidth,sHeight; 
	if (typeof(document.body.offsetWidth) == 'number'){
	   sWidth=document.body.offsetWidth; 
	   sHeight=document.body.offsetHeight; 
	}
	if (typeof(document.body.clientHeight) == 'number'){
	   sWidth=document.body.clientWidth; 
	   sHeight=document.body.clientHeight; 
	}
	var totalHeight = document.documentElement.scrollTop + msgh;
	if(sHeight < totalHeight){
		sHeight = totalHeight +100;
	}
	
	//Specify the attributes (opacity etc.) for the background of the overlay
	var bgObj=document.createElement("div"); 
    bgObj.setAttribute('id','bgDiv'); 
    bgObj.style.position="absolute"; 
    bgObj.style.top="0"; 
    bgObj.style.background="#000"; 
    bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
    bgObj.style.opacity="0.8"; 
    bgObj.style.left="0"; 
   bgObj.style.width=sWidth + "px"; 
   bgObj.style.height=sHeight + "px"; 
   bgObj.style.zIndex = "10000"; 
   bgObj.style.overflowY = "auto"; 
   document.body.appendChild(bgObj); 
   //Create the Overlay Element and specify the overlay attributes  
   var msgObj=document.createElement("div") 
   msgObj.setAttribute("id","msgDiv"); 
   msgObj.setAttribute("align","center"); 
   msgObj.style.background="white"; 
   msgObj.style.border="1px solid " + bordercolor; 
   msgObj.style.position = "absolute"; 
   msgObj.style.left = "50%"; 
   msgObj.style.top = "15%"; 
   msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   msgObj.style.marginLeft = "-225px" ; 
   if(document.documentElement.scrollTop !=0){
   msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; 
   }
   else{
   msgObj.style.marginTop= -75+ document.body.scrollTop +"px";
   }
   msgObj.style.width = msgw + "px"; 
   msgObj.style.height =msgh + "px"; 
   msgObj.style.textAlign = "center"; 
   msgObj.style.lineHeight ="25px"; 
   msgObj.style.zIndex = "10001"; 
   //Create the Overlay Title and specify the  attributes 
   var title=document.createElement("h4"); 
   title.setAttribute("id","msgTitle"); 
   title.style.margin="0"; 
   title.style.padding="3px"; 
   title.style.background=bordercolor; 
   title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
   title.style.opacity="0.75"; 
   title.style.border="1px solid " + bordercolor; 
   title.style.height="18px"; 
   title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   title.style.fontWeight="Bold"; 
   title.style.color="#404040"; 
   title.style.cursor="pointer"; 
   title.innerHTML="<table width='100%'><tr><td align='left'><div align='left'><b>Stay Informed</b></div></td><td align='right'><b>Close</b></td></tr></table>"; 
   //Function for the actions to be done when the overlay is closed 
   title.onclick=function(){ 
          document.body.removeChild(bgObj); 
          document.getElementById("msgDiv").removeChild(title); 
          document.body.removeChild(msgObj); 
		  if(document.getElementById("flash")){
				document.getElementById("flash").style.visibility='visible';
			}
        } 
    //Load the required contents into the overlay
   document.body.appendChild(msgObj); 
   document.getElementById("msgDiv").appendChild(title); 
   var txt=document.createElement("p"); 
   txt.style.margin="1em 0" 
   txt.setAttribute("id","msgTxt"); 
   txt.innerHTML=str; 
   document.getElementById("msgDiv").appendChild(txt); 
}


//function to validate Zip code and call the news letter
function checkZip(){
	var var_zip=document.getElementById('zip').value;
	//alert(var_zip);
		if ( validateZIP(var_zip)){
			newsletter();
		}

}

//Function to check the format of Zip code
function validateZIP(field) {
var valid = "0123456789-";
var hyphencount = 0;
//alert(valid);
if (field.length!=5 && field.length!=10) {
alert("Please enter a valid Zip Code, like '#####' or '#####-####'");
return false;
}
for (var i=0; i < field.length; i++) {
temp = "" + field.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your zip code.Please enter a valid Zip Code, like '#####' or '#####-####'");
return false;
}
if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
alert("Please enter a valid Zip Code, like '#####' or '#####-####'");
return false;
   }
}
return true;
}


// function to add the Flcikr Overlay


function flickr(){
	if(document.getElementById("flash")){
	  document.getElementById("flash").style.visibility='hidden';
	}
	
	var str = '<iframe align="center" src="http://www.flickr.com/slideShow/index.gne?group_id=&user_id=48120460@N06&set_id=&text=" frameBorder="0" width="600" height="500" scrolling="no"></iframe>'; 
	var msgw,msgh,bordercolor; 
	msgw=600;//Width
	msgh=530;//Height 
   titleheight=25 //title Height
   bordercolor="#DEDEDE";//boder color
   titlecolor="#99CCFF";//title color
   //Get the actual body height / width to set the width of the overlay background
   var sWidth,sHeight; 
	if (typeof(document.body.offsetWidth) == 'number'){
	   sWidth=document.body.offsetWidth; 
	   sHeight=document.body.offsetHeight; 
	}
	if (typeof(document.body.clientHeight) == 'number'){
	   sWidth=document.body.clientWidth; 
	   sHeight=document.body.clientHeight; 
	}
	var totalHeight = document.documentElement.scrollTop + msgh;
	if(sHeight < totalHeight){
		sHeight = totalHeight +100;
	}
	
	//Specify the attributes (opacity etc.) for the background of the overlay
	var bgObj=document.createElement("div"); 
    bgObj.setAttribute('id','bgDiv'); 
    bgObj.style.position="absolute"; 
    bgObj.style.top="0"; 
    bgObj.style.background="#000"; 
    bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
    bgObj.style.opacity="0.8"; 
    bgObj.style.left="0"; 
   bgObj.style.width=sWidth + "px"; 
   bgObj.style.height=sHeight + "px"; 
   bgObj.style.zIndex = "10000"; 
   bgObj.style.overflowY = "auto"; 
   document.body.appendChild(bgObj); 
   //Create the Overlay Element and specify the overlay attributes  
   var msgObj=document.createElement("div") 
   msgObj.setAttribute("id","msgDiv"); 
   msgObj.setAttribute("align","center"); 
   msgObj.style.background="#000"; 
   msgObj.style.border="1px solid " + bordercolor; 
   msgObj.style.position = "absolute"; 
   msgObj.style.left = "50%"; 
   msgObj.style.top = "15%"; 
   msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   msgObj.style.marginLeft = "-250px" ;   
   if(document.documentElement.scrollTop !=0){
   msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px"; 
   }
   else{
   msgObj.style.marginTop= -75+ document.body.scrollTop +"px";
   }
   msgObj.style.width = msgw + "px"; 
   msgObj.style.height =msgh + "px"; 
   msgObj.style.textAlign = "center"; 
   msgObj.style.lineHeight ="25px"; 
   msgObj.style.zIndex = "10001"; 
   //Create the Overlay Title and specify the  attributes 
   var title=document.createElement("h4"); 
   title.setAttribute("id","msgTitle"); 
   title.style.margin="0"; 
   title.style.padding="0px"; 
   title.style.background=bordercolor; 
   title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
   title.style.opacity="0.75"; 
   title.style.border="1px solid " + bordercolor; 
   title.style.height="18px"; 
   title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; 
   title.style.fontWeight="Bold"; 
   title.style.color="#404040"; 
   title.style.cursor="pointer"; 
   title.innerHTML="<table width='100%'><tr><td align='left'><div align='left'><b>Flickr Photos</b></div></td><td align='right'><b>Close</b></td></tr></table>"; 
   //Function for the actions to be done when the overlay is closed 
   title.onclick=function(){ 
          document.body.removeChild(bgObj); 
          document.getElementById("msgDiv").removeChild(title); 
          document.body.removeChild(msgObj); 
		  if(document.getElementById("flash")){
				document.getElementById("flash").style.visibility='visible';
			}
        } 
    //Load the required contents into the overlay
   document.body.appendChild(msgObj); 
   document.getElementById("msgDiv").appendChild(title); 
   var txt=document.createElement("p"); 
   txt.style.margin="1em 0" 
   txt.setAttribute("id","msgTxt"); 
   txt.innerHTML=str; 
   document.getElementById("msgDiv").appendChild(txt); 
}





