//Written by Bogdan Blaszczak/BlaTek

function trim(x){return x.replace(/\s+$|^\s+/g,'')}
function isPhone(x){return /^[0-9+\-() ]{8,}$/i.test(x)}
function isEmail(x){return /^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/i.test(x)}


function chkRecForm(t,e){
 e=t.fromname
 e.value=trim(e.value)
 if(e.value==''){e.focus();alert('Write Your Name!');return!1}
 e=t.fromemail
 e.value=trim(e.value)
 if(!isEmail(e.value)){e.focus();alert('Your E-mail is not correct!');return!1}
 e=t.toname
 e.value=trim(e.value)
 if(e.value==''){e.focus();alert('Write Your Friend Name!');return!1}
 e=t.toemail
 e.value=trim(e.value)
 if(!isEmail(e.value)){e.focus();alert('Your Friend E-mail is not correct!');return!1}
 return!0
}


function popup(x,s,w,h,l,t,n,O){
s=s?'yes':'no';w=w?w:'430';h=h?h:'370';l=l?l:'50';t=t?t:'50';n=n?n:'popWin'
 O=window.open(x,n,'left='+l+',top='+t+',width='+w+',height='+h+',scrollbars='+s)
 return O&&O.opener&&O.opener==self
}

function recommend(x,O){
 O=window.open(x,'recWin','left=100,top=120,width=450,height=270')
 return O.opener&&O.opener==self
}

