function doPreload()
{

	var the_images = new Array('../../../images/general/logo.gif','../../../images/general/home.gif','../../../images/general/about.gif','../../../images/general/services.gif','../../../images/general/feautres.gif','../../../images/general/portfolio.gif','../../../images/general/contact.gif','../../../images/general/services01.gif','../../../images/general/services02.gif','../../../images/general/services03.gif','../../../images/general/services04.gif','../../../images/general/services05.gif','../../../images/home/latest_features_title.gif','../../../images/side_photos/1.jpg','../../../images/side_photos/2.jpg','../../../images/side_photos/3.jpg','../../../images/side_photos/4.jpg','../../../images/side_photos/5.jpg','../../../images/side_photos/6.jpg','../../../images/side_photos/7.jpg','../../../images/side_photos/8.jpg','../../../images/side_photos/9.jpg','../../../images/side_photos/10.jpg','../../../images/side_photos/11')
}

function preloadImages(the_images_array) {

	for(loop = 0; loop < 37; loop++)
	{
   		var an_image = new Image();
		an_image.src = the_images_array[loop];
	}	
}


function getRanNum(ranMax)
{
    var ranNum= Math.ceil(Math.random()*ranMax);
    return ranNum;
}

//Mouse Over
if(document.images){

Inactive01=new Image;
Active01=new Image;
Inactive01.src='../../../images/general/home.gif';
Active01.src='../../../images/general/home_on.gif';

Inactive02=new Image;
Active02=new Image;
Inactive02.src='../../../images/general/about.gif';
Active02.src='../../../images/general/about_on.gif';

Inactive03=new Image;
Active03=new Image;
Inactive03.src='../../../images/general/services.gif';
Active03.src='../../../images/general/services_on.gif';

Inactive04=new Image;
Active04=new Image;
Inactive04.src='../../../images/general/features.gif';
Active04.src='../../../images/general/features_on.gif';

Inactive05=new Image;
Active05=new Image;
Inactive05.src='../../../images/general/portfolio.gif';
Active05.src='../../../images/general/portfolio_on.gif';

Inactive06=new Image;
Active06=new Image;
Inactive06.src='../../../images/general/contact.gif';
Active06.src='../../../images/general/contact_on.gif';

      }

 
/************************************no left cllick********************************/
function checkDate(day, month, year)
{
	if ( (isNaN(day)) || (isNaN(month)) || (isNaN(year)) ) 
	{
		//alert("Please use digits only");
		return false;
	}
		
	if (month>12 || month<1) 
	{
		//alert("Invalid month");
		return false;
	}
	
	if ((month == 1 || 
		 month == 3 || 
		 month == 5 || 
		 month == 7 || 
		 month == 8 || 
		 month == 10 || 
		 month == 12) && (day > 31 || day < 1)) 
	{
		//alert("Invalid day in month");
		return false;
	}
	if ((month == 4 || 
		month == 6 || 
		month == 9 || 
		month == 11) && (day > 30 || day < 1)) 
	{
		//alert("Invalid day in month");	
		return false;
	}
	if (month == 2) 
	{
		if (day < 1) 
		{
			//alert("Invalid day in month");	
			return false;
		}
		if (LeapYear(year) == true) 
		{
			if (day > 29) 
			{
				//alert("Invalid day in month");				
				return false;
			}
		}
		else 
		{
			if (day > 28) 
			{
				return false;
			}
		}
	} // end of if month = 2
	return true;
}
	
//-------------------------------------
// Function:		LeapYear
// Purpose:			Check if year is leap
// Parameters:		input  - 	year	
// return values:	true/false
//-------------------------------------
function LeapYear(intYear) 
{
	if (intYear % 100 == 0) 
	{
		if (intYear % 400 == 0) 
		{ 
			return true; 
		}
	}
	else 
	{
		if ((intYear % 4) == 0) 
		{
			return true; 
		}
	}
	return false;
}
//check if given file has picture ext
function checkIfGif(str){
	var gifStr = new String()
	var extStr = new String()
			
	gifStr = str ;
	extStr = gifStr.substr(gifStr.lastIndexOf(".") + 1) ;
	extStr = extStr.toLowerCase() ;
	if(extStr != "gif" && extStr != "bmp" && extStr != "jpg"){
		alert("קובץ תמונה לא חוקי") ;
		return false ;
	}
			
	return true ;
}//of checkIfGif

function popWin(pageUrl, pageName, pageWidth, pageheight, noBars){
	if(noBars == 1){
		newWin = open(pageUrl, pageName,"width=" + pageWidth + ",height=" + pageheight + ",status=מם,scrollbars=מם,left=250,top=10,menubar=no,resizable=no,address=no")
	}
	else{
		newWin = open(pageUrl, pageName,"width=" + pageWidth + ",height=" + pageheight + ",status=yes,scrollbars=yes,left=250,top=10,menubar=yes,resizable=yes,address=1")
	}
}

		/*gets fieldName, formname, max chrecters num, caption field,
		fromValCheck tells whther it came from keypress event or from
		form validation check.
		returns true if less then maxChar else returns false
		*/
		
		function countChars(fieldName, formName, maxChars, fieldCaption, fromValCheck){
			var obj ;
			var str = new String()
			obj = eval("document." + formName + "." + fieldName)
			str = obj.value
			if((str.length + 1) >  maxChars){
				if(fromValCheck){
					maxChars = maxChars 
					alert(fieldCaption + " field length sohuld be no more then " + maxChars + " characters")
				}
				else{
					alert(fieldCaption + " field length sohuld be no more then " + maxChars + " characters")
				}
				return false ;
			}
			else{
				return true ;
			}
		}// of countChars
		
		whiteSpace = " \t\n" ;

	////
	// Returns true if there is a white space (actually a string)
	//  contained within string c.
	function whiteSpaceInString (s, w)
	{   
		noWhiteSpaceFlg = 0;
		for (i = 0; i < w.length; i++)
	    {   
			if (s.indexOf(w.charAt(i)) != -1)
				noWhiteSpaceFlg = 1;
	    }
	    if (noWhiteSpaceFlg == 1)
			return (true);
		else
			return (false);
	}
	/**
		gets a string and then checks whether it's a valid email or not.
		returns true if the email in string s is valid email.
	*/
	function isEmail (s)
	{ 
		if (s.length == 1) return false;
		
	    // is s whitespace?
	    if (whiteSpaceInString(s,whiteSpace )) return false;
	    
	    // there must be >= 1 character before @, so we
	    // start looking at character position 1 
	    // (i.e. second character)
	    var i = 1;
	    var sLength = s.length;
	
	    // look for @
	    while ((i < sLength) && (s.charAt(i) != "@"))
	    { 
			i++
	    }
	
	    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
	    else i += 2;
	
	    // look for .
	    while ((i < sLength) && (s.charAt(i) != "."))
	    { 
			i++
	    }
	
	    // there must be at least one character after the .(dot)
	    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
	    else return true;
	}
	



