function checkValueOnFocus(str){

	var formValues = new Array("שם מלא*","כתובת אימייל*","טלפון", "חברה");
	var fieldVal = document.getElementById(str).value;
	
	//alert(fieldVal);
	for(i = 0; i < formValues.length; i++){
		if(fieldVal == formValues[i]){
			document.getElementById(str).value = "";
			document.getElementById(str).style.color = "#040404";
			return;
		}
		
	}
	
	
}

function checkValueOnBlur(str){
	
	var formValues = new Array("שם מלא*","כתובת אימייל*","טלפון", "חברה");
	var fieldVal = document.getElementById(str).value;
	
	var fieldNo = str.slice(5);
	
	if(fieldVal.length == 0){
		document.getElementById(str).value = formValues[fieldNo];
		document.getElementById(str).style.color = "#979797";
	}

	return;
}

function validateMyForm(){
	var x = document.getElementById('myform').getElementsByTagName("input");
	var formValues = new Array("שם מלא*","כתובת אימייל*","טלפון", "חברה");
	var ob; //object
	var err = 0;
	
	//Checks weather necessary input fields were left unfilled
	for(i = 0; i < 2; i++ ){
		ob = x[i].value;
		
		if(ob == formValues[i]){
			x[i].style.backgroundColor="#f1ebdb";
			err++;}
		
		if(ob.length < 2){ 
			x[i].style.backgroundColor="#f1ebdb";
			err++; }
	}
	ob = x[1].value;
	var email = ob.match("@");
	if(email == null){
		x[1].style.backgroundColor="#f1ebdb";	
		err++;
	}
	
	var y = document.getElementById('myform').getElementsByTagName("select");
	ob = y[0].value;
	if(ob.length == 0){
		y[0].style.backgroundColor="#f1ebdb";
		err++; 
	}
	else { y[0].style.backgroundColor="#fff"; }
	
	
	if(err > 0){
		document.getElementById("replace_contact_header").style.backgroundImage="url(img/contact_us_text1.gif)";
		return false;
	}
	else{ return true; }
}

function changeContactHeader(){
	document.getElementById("replace_contact_header").style.backgroundImage="url(img/contact_us_text.gif)";
}

function getQuote(str){
	var x = document.getElementById('myform').getElementsByTagName("select");
	x[0].options[x[0].selectedIndex].text="קבלת הצעת מחיר לתרגום";
	
	var text = document.getElementById('myform').getElementsByTagName("textarea");
	text[0].value = "שלום, הייתי רוצה לקבל הצעת מחיר ל"+str+". אנא צרו עימי קשר בהקדם האפשרי.";
	
	document.getElementById("replace_contact_header").style.backgroundImage="url(img/contact_us_text.gif)";
}

function openWin(page){
	w = 500;
	h = 500;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1,resizable=0,location=0,status=1,menubar=0,toolbar=1'
	win = window.open(page, "", winprops);
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}