navinfo = navigator.userAgent.split(' ');
var ie7 =  navinfo[3]=='7.0;' ? true : false;
if(ie7){
document.write('<link rel="StyleSheet" href="/_media/css/ifIe7.css" type="text/css">');
}

function $(id){
	return document.getElementById(id);
}

function contactShow(data){
	var divId = $('contact');
	divId.innerHTML = data;	
}


var curPic;

function contactMainSend(){
	var phone = document.contactMe.phone.value;
	var name = document.contactMe.name.value;
	if(name == ""){
		alert ("נא להכניס שם.");
		return false;
	}else if(phone==""){
		alert ("נא להכניס מספר טלפון.");
		return false;
	}else{
//		doAjax('contact.send.ajax.php',contactShow,'phone=' + phone + '&name=' + name);
 		document.contactMe.submit();
	}
}

function showVid(vid,title,object){
	document.getElementById('bigPicDiv').innerHTML = '<div id="pic"></div>';
	var swfPath = "/media/player.swf"; 			// video player swf path
	var id      = "oxylus-video-player"; // html flash object embed id
	var width   = "370"; 					// video player width
	var height  = "395"; 					// video player height
	var bgColor = "#000000"; 				// videoplayer html background color
	var so      = new SWFObject(swfPath, id, width, height, "9", bgColor); // create new swf object
	
	so.addParam("allowfullscreen", "true"); // if set to true the video can go into fullscreen mode
	
	so.addVariable("movie",     "/media/userfiles/catalog/video/"+vid+".flv");          // path to the movie file (FLV / H.264 / RTMP supported)
	so.addVariable("title",     title); // title string
	so.addVariable("videosize", "0");                       // 0 - fit, 1 - crop, 2 - original size, 3 - half size, 4 - stretch ( default: 0 )
	so.addVariable("buffer",    "1");                        // buffer time in seconds  ( default: 3)
	so.addVariable("volume",    "10");                      // sound volume: value between 0 - 100 ( default: 75 )  
	so.addVariable("autoplay",  "true");                    // auto start playback : true / false ( default: false )  
	so.addVariable("repeat",    "true");                   // repeat playback after playback completed : true / false ( default: false )  
	so.addVariable("smoothing", "true");                    // set video smoothing : true / false ( default: false )  
	so.addVariable("picture", "pic.jpg");                    

	so.write("pic"); // write the swf into html
	
	var oldPreview = document.getElementById(curPic);
	oldPreview.style.border="1px solid #ECF0F3";
	object.style.border = "1px solid #262427";
	curPic = object.id;
}


function switchImg(imgId,object){
	document.getElementById('bigPicDiv').innerHTML = '<div id="pic"><img src="" id="bigPic" ></div>';
	var newSrc = object.getAttribute('bigSrc');
	var newWidth = object.getAttribute('fixedWidth');
	var newHeight = object.getAttribute('fixedHeight');
	
	var bigImg = document.getElementById(imgId); 
	bigImg.src = newSrc;
	bigImg.style.width = "450px";
	
	
	var oldPreview = document.getElementById(curPic);
	oldPreview.style.border="1px solid #ECF0F3";
	object.style.border = "1px solid #262427"
	
	curPic = object.id;
	
}

function contactMainSendHever(){
	var phone = document.contactMe.phone.value;
	if(document.contactMe.name.value==""){
		alert ("נא להכניס שם.");
		document.contactMe.name.focus();
		return false;
	}else if(phone==""){
		alert ("נא להכניס מספר טלפון.");
		document.contactMe.phone.focus();
		return false;
	}else{
		document.contactMe.submit();
	}
}

function validateContact(){
	var form = document.getElementById('contactForm');
	if(form.fullName.value == ''){
		alert ("נא למלא שם.");
		form.fullName.focus();
	}else if(!IsEmail(form.email.value)){
		alert ("נא למלא כתובת אימייל תקנית.");
		form.email.focus();
	}else if(form.phoneNumber.value == ''){
		alert ("נא למלא מספר טלפון.");
		form.phoneNumber.focus();
	}else{
		form.submit();
	}
	
}


function validateContact_1(){
	var form = document.getElementById('contactForm');
	if(form.fullName.value == ''){
		alert ("Please fill in your name.");
		form.fullName.focus();
	}else if(!IsEmail(form.email.value)){
		alert ("Please fill in a valid email address.");
		form.email.focus();
	}else if(form.phoneNumber.value == ''){
		alert ("Please fill in your phone number.");
		form.phoneNumber.focus();
	}else{
		form.submit();
	}
	
}

function IsEmail(sText) {
	var at="@";
	var dot=".";
	var lat=sText.indexOf(at)
	var lstr=sText.length
	var ldot=sText.indexOf(dot)
	if (sText=="" || sText==null){ return false }
	if (sText.indexOf(at)==-1 || sText.indexOf(at)==0 || sText.indexOf(at)==lstr){ return false }
	if (sText.indexOf(dot)==-1 || sText.indexOf(dot)==0 || sText.indexOf(dot)==lstr){ return false }
	if (sText.indexOf(at,(lat+1))!=-1){ return false }
	if (sText.substring(lat-1,lat)==dot || sText.substring(lat+1,lat+2)==dot){ return false }
	if (sText.indexOf(dot,(lat+2))==-1){ return false }
	if (sText.indexOf(" ")!=-1){ return false }
 	return true					
}

function showDiv(id,displayValue){
	if(typeof(displayValue)=='undefined'){
		displayValue ='';
	}
	document.getElementById(id).style.display = displayValue;
	
}