// JavaScript Document

function copywrite(){
var d=new Date();
yr=d.getFullYear();
if (yr!=2006)
document.write("copyright © 2005 - "+yr+" - Mediterranean Villa Rentals - All Rights Reserved");
}


top.window.moveTo(0,0); 

if (document.all) 

   { top.window.resizeTo(screen.availWidth,screen.availHeight); } 

else if 

   (document.layers || document.getElementById) 

   { 

   if 

    (top.window.outerHeight < screen.availHeight || top.window.outerWidth < 

screen.availWidth)

     { top.window.outerHeight = top.screen.availHeight; 

       top.window.outerWidth = top.screen.availWidth; } 

   }

function MM_jumpMenu(targ,selObj,restore){ //v3.0
 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
 if (restore) selObj.selectedIndex=0;
}


function copyData(from,to) { to.value = from.value; }


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



// swearword detect 

var swear_words_arr=new 
/*Array("www","http",".php",".asp","ultram","drug","prescription","viagra","medicine",".html",".htm","prescription","50mg","sex","100mg","[","script","url","home","focus","gawab","aac","(","?","{");
*/

Array("www","http",".php",".asp","ultram","drug","prescription","viagra","medicine",".com/",".html",".htm","prescription","50mg"," sex","sex ","100mg","[","script","url","home","focus","gawab","aac","(","?","{","fuck");


var swear_alert_arr=new Array(); 
var swear_alert_count=0; 

function reset_alert_count() 
{ 
swear_alert_count=0; 
} 

function wordFilter(form,fields) 
{ 
reset_alert_count(); 
var compare_text; 
var fieldErrArr=new Array(); 
var fieldErrIndex=0; 
for(var i=0; i<fields.length; i++) 
{ 
eval('compare_text=document.' + form + '.' + fields[i] + '.value;'); 
for(var j=0; j<swear_words_arr.length; j++) 
{ 
for(var k=0; k<(compare_text.length); k++) 
{ 
if(swear_words_arr[j]==compare_text.substring(k,(k+swear_words_arr[j].length)).toLowerCase()) 
{ 
swear_alert_arr[swear_alert_count]=compare_text.substring(k,(k+swear_words_arr[j].length)); 
swear_alert_count++; 
fieldErrArr[fieldErrIndex]=i; 
fieldErrIndex++; 
} 
} 
} 
} 
var alert_text=""; 
for(var k=1; k<=swear_alert_count; k++) 
{ 
alert_text+="\n" + "(" + k + ") " + swear_alert_arr[k-1]; 
eval('compare_text=document.' + form + '.' + fields[fieldErrArr[0]] + '.focus();'); 
eval('compare_text=document.' + form + '.' + fields[fieldErrArr[0]] + '.select();'); 
} 
if(swear_alert_count>0) 
{ 
alert("Please do not use the following spam / offensive word(s):\n_______________________________\n" + alert_text + "\n_______________________________"); 
return false; 
/* JavaScript:location.reload(true);*/
} 
else 
{ 
return true; 
} 
} 


function validateme(thisform){
var isvalid = true;
	if(thisform.name.value.length <3){
		// Change this Message to Your Preferance
		alert("Please enter your name, (3 character or more)");
		isvalid = false
		thisform.name.focus();
	}
	if(isvalid){
		if (thisform.email.value.indexOf("@")==-1 || thisform.email.value.indexOf(".")==-1 ||  thisform.email.value.indexOf(" ")!=-1 || thisform.email.value.length<6){
			// Change this Message to Your Preferance
			alert("Please enter a valid email address (eg ----@----.--");
			isvalid = false
			thisform.email.focus();
    	}
	}
	if(isvalid){
		if(thisform.message.value.length <5){
		// Change this Message to Your Preferance
		alert("Please write a message with more than 5 characters and spaces!");
		isvalid = false
		thisform.message.focus();
		}
	}
return isvalid;
}

