﻿tmpBody = "";

function showResults(){
	$('searchResults').innerHTML = tmpBody;
}

function doMouseOver(what, id){
	switch (what){
		case "tt":
			/*
			$("tt"+id).style.backgroundColor = "#ffffff";
			$("tt"+id).style.borderTop = "2px solid #000000";
			$("tt"+id).style.borderBottom = "2px solid #000000";
			$("tt"+id+"_closer1a").style.display = "";
			$("tt"+id+"_closer1b").style.display = "";
			*/
	}
}

function doMouseOut(what, id){
	switch (what){
		case "tt":
			/*
			$("tt"+id).style.backgroundColor = "";
			$("tt"+id).style.border = "0";
			$("tt"+id+"_closer1a").style.display = "none";
			$("tt"+id+"_closer1b").style.display = "none";
			*/
			
	}
}

function chkForm(menu){
	
	tmpErr = "";
	$('d1').style.backgroundImage = "url('/images/input_bg1.png')";
	$('d2').style.backgroundImage = "url('/images/input_bg1.png')";
	$('d3').style.backgroundImage = "url('/images/input_bg1.png')";

	if($('fname').value.length<3){
		tmpErr += "<li>נא מלאו שם מלא</li>";
		$('d1').style.backgroundImage = "url('/images/input_bg1_err.png')";
	}
	if($('phone').value.length<9){
		tmpErr += "<li>נא מלאו מספר טלפון מלא כולל קידומת</li>";
		$('d2').style.backgroundImage = "url('/images/input_bg1_err.png')";
	}
	if(check_email($('email').value)== false || $('email').value.length<7){
		tmpErr += "<li>נא מלאו כתובת אימייל חוקית</li>";
		$('d3').style.backgroundImage = "url('/images/input_bg1_err.png')";
	}
	if(tmpErr!=""){
		$('frmErrors').innerHTML = "<ul>"+tmpErr+"</ul>";
		return false;
	}else{
		return true;
	}
}

function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}	
	} 

	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		} 
	}
}

function goSearch(){
	if($('txtSearch').value.length>1){
		location = "/p,4333,0.php?s="+$('txtSearch').value;
	}
}

function updateFile(filename){
	$('fake_file').innerHTML = filename;
}
