﻿
if (swfobject.hasFlashPlayerVersion("9.0.0")) {
	var fn = function() {	
		var att = { data:"flash/our_customers.swf", width:"217", height:"133", id:"ourCustomers"};
		var par = { flashvars:"" , swliveconnect:"true", allowScriptAccess:"sameDomain", wmode:"transparent"};
		var id = "our_customers";
		var myObject = swfobject.createSWF(att, par, id);
	};
	var hp = function() {	
		var att = { data:"flash/kidma_hp_.swf", width:"713", height:"367", id:"hpBanner"};
		var par = { flashvars:"" , swliveconnect:"true", allowScriptAccess:"sameDomain", wmode:"transparent"};
		var id = "hp_banner";
		var myObject = swfobject.createSWF(att, par, id);
	};
	swfobject.addDomLoadEvent(fn);
	swfobject.addDomLoadEvent(hp);
}
function checkCustomerdetails(){
	if(document.getElementById('txtlicenseNoService').value==""){
		alert("חובה למלא מס רישוי");
		document.getElementById('txtlicenseNoService').focus();
		return false;
	}
	if(document.getElementById('txtproblemService').value==""){
		alert("חובה למלא תאור תקלה");
		document.getElementById('txtproblemService').focus();
		return false;
	}
	if(document.getElementById('txtlocationforkliftService').value==""){
		alert("חובה למלא מיקום מלגזה");
		document.getElementById('txtlocationforkliftService').focus();
		return false;
	}
	if(document.getElementById('txtphoneService').value==""){
		alert("חובה למלא טלפון");
		document.getElementById('txtphoneService').focus();
		return false;
	}
	if(document.getElementById('txtcontactManService').value==""){
		alert("חובה למלא איש קשר");
		document.getElementById('txtcontactManService').focus();
		return false;
	}
	if(document.getElementById('txtmailService').value==""){
		alert("חובה למלא מייל");
		document.getElementById('txtmailService').focus();
		return false;
	}
	if(!IsMailIllegel(document.getElementById('txtmailService').value)){
		alert("מייל לא חוקי");
		document.getElementById('txtmailService').focus();
		return false;
	}		
	document.frmSign.submit();	
}
function checkcontactdetails(){
	if(document.getElementById('txt_Fname').value==""){
		alert("חובה למלא שם פרטי");
		document.getElementById('txt_Fname').focus();
		return false;
	}
	if(document.getElementById('txt_Lname').value==""){
		alert("חובה למלא שם משפחה");
		document.getElementById('txt_Lname').focus();
		return false;
	}	
	if(document.getElementById('txt_PhoneWork').value=="" && document.getElementById('txt_Cell').value==""){
		alert("חובה למלא לפחות טלפון אחד");
		return false;
	}	
	if(document.getElementById('txt_mail').value==""){
		alert("חובה למלא מייל");
		document.getElementById('txt_mail').focus();
		return false;
	}
	if(!IsMailIllegel(document.getElementById('txt_mail').value)){
		alert("מייל לא חוקי");
		document.getElementById('txt_mail').focus();
		return false;
	}		
	document.frmSign.submit();	
}
function IsMailIllegel(obj){
	var theString = obj;
	var emailexpr = new RegExp("^[^@\\s]+@[^@\\s]+\\.[^@]*\\w\\w$","gi")
	if (!emailexpr.test(theString)){
		return false;
	}else{
		return true;
	}	
}
function checkofferdetails(){
	if(document.getElementById('txt_Company').value==""){
		alert("חובה למלא שם חברה");
		document.getElementById('txt_Company').focus();
		return false;
	}
	if(document.getElementById('txt_Fname').value==""){
		alert("חובה למלא שם");
		document.getElementById('txt_Fname').focus();
		return false;
	}
	if(document.getElementById('txt_PhoneWork').value=="" && document.getElementById('txt_Cell').value==""){
		alert("חובה למלא לפחות טלפון אחד");
		return false;
	}	
	if(document.getElementById('txt_mail').value==""){
		alert("חובה למלא מייל");
		document.getElementById('txt_mail').focus();
		return false;
	}
	if(!IsMailIllegel(document.getElementById('txt_mail').value)){
		alert("מייל לא חוקי");
		document.getElementById('txt_mail').focus();
		return false;
	}		
	document.frmSign.submit();	
}
var requestedWidthProduct = 110;
var requestedWidthProductNew = 205;
var requestedHeightProductNew = 180;
var showImage = function(obj){
	//console.log("chaim>> "+obj);
	$(obj).fadeIn();
}
$.fn.toggleCheckbox = function() {
    this.attr('checked', !this.attr('checked'));
}

$(document).ready(function() {
	// for IE... 
	if (!window.console) console = {};
	console.log = console.log || function(){};
	// and add trace option...
	if (!window.trace) trace = function(val){console.log(val)};
	// top navigation shadow
	$('.menu ul li a').each(function() {
		$(this).click(function() {
			$(this).blur();
		});
	});
	
	$('.proImage img').each(function() {
		$(this).aeImageResize({ width:requestedWidthProduct, callback:showImage });
	})
	$('.tbl_new .big_image img').each(function() {
		$(this).aeImageResize({ width:requestedWidthProductNew, height:requestedHeightProductNew, callback:showImage });
	})
	 $("#advanced").click(function () { 
		this.blur();
		$('#searchbox_body').animate({
				height: '140'
			}, 400, function() {
				// Animation complete.
			});
		$('.searchbox_body_bottom').animate({
				height: '90'
			}, 400, function() {
				// Animation complete.
			});
		$('.searchbox_button').animate({
				top: '110'
			}, 400, function() {
				// Animation complete.
			});
		
		return false;
    });
	$('.tbl_new tr.head td div span').each(function() {
		var thisText = $(this).text() + "...";
		while($(this).height()>30){
			$(this).text(thisText.substring(0, thisText.length-4) + "...");
			thisText = $(this).text();
		}
	})
	$('.cornerd_box .body5 .vid_holder a').each(function() {
		var thisText = $(this).text() + "...";
		while($(this).height()>24){
			$(this).text(thisText.substring(0, thisText.length-4) + "...");
			thisText = $(this).text();
		}
	})
});		

