/**
 * WC common header and footer behaviors.
 * 0.0.2 . 20110504
 * Deployed to \\uploadb\imagestore\theknot\jscripts\WC\WC.HeaderFooterBehaviors-x.x.x.min.js
 * Current maintainer: Jeffrey Barke
 *
 * Cobbled together from various legacy JavaScripts.
 */
function open_popup(url,w,h,resize,scroll,wname){wname=(wname==null)?'popwin':wname.replace(new RegExp(/ /g),'');scroll=((scroll==null)||(scroll=='')||(scroll==1)||(scroll=='1'))?'yes':'no';resize=((resize==null)||(resize=='')||(resize==1)||(resize=='1'))?'yes':'no';var properties="toolbar=0,scrollbars="+scroll+",location=0,statusbar=1,menubar=0,resizable="+resize;properties+=",width="+w+",height="+h;child=window.open(url,wname,properties);child.focus();}
function swap(id,url){var oImg=document.getElementById(id);if(oImg){oImg.src=url;return true;}else{return false;}}
function handleKeyPress(e,form){var key=e.keyCode||e.which;if(key===13){document.location.href='http://global.weddingchannel.com/search/default.aspx?cx=009992541774839403818%3Avp5aphu7jei&cof=FORID%3A9&ie=UTF-8&sa=Search#1188&q='+document.getElementById('quest').value;return false;}}
function CreateBookmarkLink(){title="WeddingChannel.com";url="http://www.weddingchannel.com";if(window.sidebar){window.sidebar.addPanel(title,url,"");}else if(window.external){window.external.AddFavorite(url,title);}
else if(window.opera&&window.print){return true;}}
var thisserver=window.location.hostname;var expDays=1;function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function FixCookieDate(date){var base=new Date(0);var skew=base.getTime();if(skew>0)
date.setTime(date.getTime()-skew);}
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,expires,path,domain,secure){document.cookie=name+"="+escape(value)+
((expires)?"; expires = "+expdate.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain = "+domain:"")+
((secure)?"; secure":"");}
function getMemberinfo(property){var propertyvalue='';if(window.location.hostname.substr(0,3)=='dev'){var memberinfo=GetCookie('memberinfo_dev');}else{var memberinfo=GetCookie('memberinfo');}
if(memberinfo!=null&&memberinfo!=''&&memberinfo.indexOf('^'+property+'~')!=-1){var startpos=memberinfo.indexOf('^'+property+'~');if(startpos!=-1){startpos+=property.length+2;var endpos=memberinfo.indexOf('^',startpos);if(endpos!=-1){propertyvalue=memberinfo.substring(startpos,endpos);propertyvalue=unescape(propertyvalue);}}}
if(memberinfo!=null&&memberinfo!=''&&memberinfo.indexOf('|'+property+'^')!=-1){var startpos=memberinfo.indexOf('|'+property+'^');if(startpos!=-1){startpos+=property.length+2;var endpos=memberinfo.indexOf('|',startpos);if(endpos!=-1){propertyvalue=memberinfo.substring(startpos,endpos);propertyvalue=unescape(propertyvalue);}}}
return propertyvalue;}
function LZ(x){return(x<0||x>=10?'':'0')+x;}
var expdate=new Date();FixCookieDate(expdate);expdate.setTime(expdate.getTime()+(expDays*24*60*60*1000));var showUnload=false;function SetCookie2(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+
((expires)?"; expires = "+new Date(expires).toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain = "+domain:"")+
((secure)?"; secure":"");}
function checkDate(){var lastdate=GetCookie('dateshown');var nestredirected=GetCookie('newnest');var weddingdate=getMemberinfo("weddingdate");var todayTime=new Date();if(weddingdate!=null&&parseInt(weddingdate)<parseInt(todayTime.getYear()+LZ(todayTime.getMonth()+1)+LZ(todayTime.getDate())+'')&&nestredirected!="true")
{SetCookie2('newnest',"true",todayTime.getTime()+(3600000*24*900),'','theknot.com');window.location="http://www.thenest.com";window.open('email_thenest_pop.html','thenest',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width=400,height=300,left=400,top=400,screenX=400,screenY=510");return;}
if(lastdate!=expdate.getDate()){showUnload=true;}}
function popunder(){if(showUnload){var random_num=Math.random()*4;var window_num=Math.round(random_num);}}
function checkMemberCookie(){var membercookie=GetCookie('TMPAUTHTIX');if(membercookie&&membercookie.indexOf('userId')!==-1){return true;}
return false;}
function getDayString(num){var day;var days=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");day=((num>=0)||(num<7))?days[num]:"Invalid Day";return day;}
function getMonthString(num){var month;var months=new Array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");month=((num>=0)||(num<12))?months[num]:"Invalid Month";return month;}
theDate=new Date();
