function noJersey(theForm,selField){oForm=document.forms[theForm];var selected_index=oForm.elements[selField].selectedIndex;var selected_option_value=oForm.elements[selField].options[selected_index].value
if(selected_index>0){if(selected_option_value=="NJ"){alert("Not registered in New Jersey.");return false;}
else{return true;}}
else{alert('Please select a state from the drop down list');return false;}}
function emailCheck(emailStr){var emailPat=/^(.+)@(.+)$/;var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s"+specialChars+"\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;var atom=validChars+'+';var word="("+atom+"|"+quotedUser+")";var userPat=new RegExp("^"+word+"(\\."+word+")*$");var domainPat=new RegExp("^"+atom+"(\\."+atom+")*$");var matchArray=emailStr.match(emailPat);if(matchArray==null){alert("Email address seems incorrect (check @ and .'s)");return false;}
var user=matchArray[1];var domain=matchArray[2];if(user.match(userPat)==null){alert("The username doesn't seem to be valid.");return false;}
var IPArray=domain.match(ipDomainPat);if(IPArray!=null){for(var i=1;i<=4;i++){if(IPArray[i]>255){alert("Destination IP address is invalid!");return false;}}
return true;}
var domainArray=domain.match(domainPat);if(domainArray==null){alert("The domain name doesn't seem to be valid.");return false;}
var atomPat=new RegExp(atom,"g");var domArr=domain.match(atomPat);var len=domArr.length;if(domArr[domArr.length-1].length<2||domArr[domArr.length-1].length>3){alert("The email address must end in a three-letter domain, or two letter country.");return false;}
if(len<2){var errStr="This address is missing a hostname!";alert(errStr);return false;}
return true;}
function UPTvalidateform(thisform)
{if(thisform.val_1.value=="")
{alert("First Name is a required field and appears to be blank.");thisform.val_1.focus();return(true);}
if(thisform.val_1.value=="First Name")
{alert("Please enter your first name.");return true;}
if(!noJersey('UPTml17666','val_6')||!emailCheck(thisform.email.value))
{return true;}
alert('Thank you for signing up for the Robson Living eNewsletter!');return false;}
function getSelect(theForm,selField){oForm=document.forms[theForm];var selected_index=oForm.elements[selField].selectedIndex;if(selected_index>0){var selected_option_value=oForm.elements[selField].options[selected_index].value;var selected_option_text=oForm.elements[selField].options[selected_index].text;window.location=selected_option_value;}else{}}
var slideTimer,hideClock,checkImage,fadeTimer;var playing=1;var interval=4000;var ImageNum=0;var imageDir='http://www.robson.com/images/default/template/';VertPos=new Array(1,2,3,4,5,6,7,8,9,10);var number_of_image=VertPos.length;function startShow(place){slideshowImages=new Image();slideshowImages.src=imageDir+"homepage_photo1.jpg";nextSlide();}
function nextSlide(){var new_image=getNextImage();document.getElementById('rImage').style.backgroundImage='url('+imageDir+'homepage_photo'+new_image+'.jpg)';fade(.08);if(playing==1){clearTimeout(slideTimer);var recur_call="nextSlide('"+new_image+"')";slideTimer=setTimeout(recur_call,interval);}}
function getNextImage(){ImageNum=(ImageNum+1)%number_of_image;var new_image=VertPos[ImageNum];return(new_image);}
function prevSlide(){if(playing==1){clearTimeout(slideTimer);var recur_call="nextSlide()";slideTimer=setTimeout(recur_call,interval);}
var new_image=getPrevImage();document.getElementById('rImage').style.backgroundImage='url('+imageDir+'homepage_photo'+new_image+'.jpg)';fade(.08);}
function getPrevImage(){ImageNum=(ImageNum-1);if(ImageNum<=-1){ImageNum=number_of_image-1;}
var new_image=VertPos[ImageNum];return(new_image);}
function pauseSS(place)
{clearTimeout(slideTimer);playing=0;}
function continueSS(place)
{playing=1;nextSlide(place);}
function fade(fadeRate){fadeTimer=undefined;fadestate=document.getElementById('fImage').style.opacity;if(fadestate>0){new_opacity=fadestate-fadeRate;document.getElementById('fImage').style.opacity=new_opacity;new_alpha=new_opacity*100;document.getElementById('fImage').style.filter='alpha(opacity = '+new_alpha+')';fadeTimer=setTimeout('fade(.08)',60);}
else{swapImg(ImageNum);}}
function swapImg(frontImage){backImage=frontImage+1;var imageDir='http://www.robson.com/images/default/template/';document.getElementById('fImage').src=imageDir+"homepage_photo"+backImage+".jpg";document.getElementById('fImage').style.opacity=1;document.getElementById('fImage').style.filter='alpha(opacity = 100)';document.getElementById('rImage').src=imageDir+"homepage_photo"+frontImage+".jpg";}
function switchBTNs(divID){if(divID=='pauseBTN'){document.getElementById('playbutton').innerHTML='<img src="http://www.robson.com/templates/robson/images/controls_r2_c3.gif"  onclick="continueSS(\'fImage\'); switchBTNs(this.id);" id="playBTN" title="Play Slide Show">';}
else{document.getElementById('playbutton').innerHTML='<img src="http://www.robson.com/templates/robson/images/controls_r2_c5.gif" onclick="pauseSS(\'fImage\'); switchBTNs(this.id);" id="pauseBTN" title="Pause Slide Show">';}}
function displayControls(arrowID,divID){if(arrowID=='expand'){document.getElementById('controlPanel').style.width='125px';document.getElementById(divID).style.display='inline';document.getElementById(arrowID).src="http://www.robson.com/templates/robson/images/hide_arrow.gif";document.getElementById(arrowID).id="hide";}
else{document.getElementById('controlPanel').style.width='15px';document.getElementById(divID).style.display='none';document.getElementById(arrowID).src="http://www.robson.com/templates/robson/images/show_arrow.gif";document.getElementById(arrowID).id="expand";}}
function timedClose(arrowID,divID){var display="displayControls('"+arrowID+"','"+divID+"')";hideClock=setTimeout(display,interval);}
function stopHideClock(){clearTimeout(hideClock);}
function nextBTN(){if(fadeTimer==undefined){clearTimeout(slideTimer);var recur_call="nextSlide()";slideTimer=setTimeout(recur_call,interval);nextSlide();}
else{clearTimeout(fadeTimer);fadeTimer=undefined;swapImg(ImageNum);}}
function prevBTN(){if(fadeTimer==undefined){clearTimeout(slideTimer);var recur_call="prevSlide()";slideTimer=setTimeout(recur_call,interval);prevSlide();}
else{clearTimeout(fadeTimer);fadeTimer=undefined;swapImg(ImageNum);}}