function showBtn(btn)
{
	$("#"+btn).css("display","inline");
}

function loadComp(value, div, num)
{
	if(value) $("#"+div).load("/output.php?sec=input&id=selectcomp&name=models&sname=models&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=loadVersion(this.value ,'V"+div+"')&where=manufacturer&isactive=yes&value="+value);
	$('#VTestModelsbox'+num).load("/output.php?sec=input&id=selectcomp&name=version&sname=&option=%D7%91%D7%97%D7%A8+%D7%92%D7%A8%D7%A1%D7%94&jsfunc=&where=model&isactive=yes&value=-1");
}

function loadVersion(value, div)
{
	if(value) $("#"+div).load("/output.php?sec=input&id=select&name=version&sname=S"+div+"&option=%D7%91%D7%97%D7%A8+%D7%92%D7%A8%D7%A1%D7%94&jsfunc=&where=model&isactive=yes&value="+value);
}

function loadModels(value, div)
{ 
	if(value) $("#"+div).load("/output.php?sec=input&id=select&name=models&isactive=yes&sname=models&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=MoveModels(getElementById('models').value, getElementById('models').options[getElementById('models').selectedIndex].text, getElementById('manufacturer').options[getElementById('manufacturer').selectedIndex].text)&where=manufacturer&isactive=yes&value="+value+"&button=MoveModels(getElementById('models').value, getElementById('models').options[getElementById('models').selectedIndex].text, getElementById('manufacturer').options[getElementById('manufacturer').selectedIndex].text)");
}

function loadModels2(value, div)
{ 
	if(value) $("#"+div).load("/output.php?sec=input&id=select&name=models&isactive=yes&sname=fmodels&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=MoveModels(getElementById('fmodels').value, getElementById('fmodels').options[getElementById('fmodels').selectedIndex].text, getElementById('fmanufacturer').options[getElementById('fmanufacturer').selectedIndex].text)&where=manufacturer&isactive=yes&value="+value+"&button=MoveModels(getElementById('fmodels').value, getElementById('fmodels').options[getElementById('fmodels').selectedIndex].text, getElementById('fmanufacturer').options[getElementById('fmanufacturer').selectedIndex].text)");
}

function loadModelsByForm(value, div, form)
{
	if(value) $("#"+div).load("/output.php?sec=input&id=selectmodelbyform&sname="+form+"_models&form="+form+"&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=&jsfunc=OpenFormByWin("+form+", getElementById('"+form+"_models').value)&where=manufacturer&value="+value+"&button=OpenFormByWin("+form+", getElementById(\'"+form+"_models\').value)");
}

function loadModelsByPageForm(value, div, form)
{
	if(value) $("#"+div).load("/output.php?sec=input&id=selectmodelbyform&sname=models&form="+form+"&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=OpenForm("+value+")&where=manufacturer&value="+value+"&button=OpenForm("+value+")");
}

function loadModelsByPageFormLeasing(value, div, form, isNewLease, selected)
{
	if(typeof(isNewLease)=='undefined'){var isNewLease=0;}
	if(typeof(selected)=='undefined'){var selected=0;}
	if(value) $("#"+div).load("/output.php?sec=input&selected="+selected+"&id=selectmodelbyformleasing&sname="+(isNewLease?'leasing_models':'models')+"&form="+form+"&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=gotoLeaseModel("+isNewLease+")&where=manufacturer&value="+value+"&button=gotoLeaseModel("+isNewLease+")");
}
function gotoLeaseModel(isNewLease){
	var modelsElem = '';
	var manuElem = '';
	if(isNewLease==1){
		modelsElem = document.getElementById('leasing_models');
		manuElem = document.getElementById('leasing_manufacturer');
	}else{
		modelsElem = document.getElementById('models');
		manuElem = document.getElementById('manufacturer');
	}
	document.location.href = "/LeasModel/"+modelsElem.value+"/"+manuElem.options[manuElem.selectedIndex].text+"_"+modelsElem.options[modelsElem.selectedIndex].text;
}

// important - for URL structure ---> change here!! <<---------------------------------------
function MoveModels(value, label, manuf)
{
	if(value=="-1") {
		
		window.location='/Manufacturer/'+document.getElementById('jmpmenu').value+"/"+manuf; 
		//alert(document.getElementById('jmpmenu').value);
	}
	else window.location='/Model/'+value+'/'+manuf+'_'+label;
}

function MoveCategory(value)
{
	//alert("Category Location ID: "+value);
	window.location='/Category/' + value + "/" + document.getElementById('ncategory').options[document.getElementById('ncategory').selectedIndex].text;
}

function MoveLeasing(value)
{
	window.location='/CategoryLeasing/' + value + "/" + document.getElementById('leasing_category').options[document.getElementById('leasing_category').selectedIndex].text;
	//alert("Leasing Location ID: "+value);
}

function LoadNewBox(model, manuf)
{
	$("#FastManufactbox").load("/output.php?sec=input&id=select&name=manufacturer&sname=manufacturer&option=%D7%91%D7%97%D7%A8+%D7%99%D7%A6%D7%A8%D7%9F&selected="+manuf+"&jsfunc=loadModels(getElementById('manufacturer').value, 'FastModelsbox')");
	$("#FastModelsbox").load("/output.php?sec=input&id=select&name=models&isactive=yes&sname=models&option=%D7%91%D7%97%D7%A8+%D7%93%D7%92%D7%9D&jsfunc=MoveModels(getElementById('models').value, getElementById('models').options[getElementById('models').selectedIndex].text, getElementById('manufacturer').options[getElementById('manufacturer').selectedIndex].text)&where=manufacturer&selected="+model+"&value="+manuf+"&button=MoveModels(getElementById('models').value, getElementById('models').options[getElementById('models').selectedIndex].text, getElementById('manufacturer').options[getElementById('manufacturer').selectedIndex].text)");
}

function OpenForm(id)
{
	$("#thisform").show();
	$("#PathBox").hide();
	$("#modelform").attr("value", gE('models').value);
	//window.open('/output.php?sec=form&id='+id,'mywindow','width=300,height=400,left=0,top=100,screenX=0,screenY=100');
}

function OpenTestdrive(id)
{
	window.open('/output.php?sec=form&id=5&mid='+id,'mywindow','width=300,height=500,left=300,top=100,screenX=0,screenY=100,resizeable=no');
}

function OpenFormByWin(id, mid)
{
	window.open('/output.php?sec=form&id='+id+'&mid='+mid,'mywindow','width=300,height=500,left=300,top=100,screenX=0,screenY=100,resizeable=no');
}

function Comparison(isEx){
	total=0;
	goCar="";
	if(gE('SVTestModelsbox1')) if(gE('SVTestModelsbox1').value) { total = total + 1; goCar = gE('SVTestModelsbox1').value }
	if(gE('SVTestModelsbox2')) if(gE('SVTestModelsbox2').value) { total = total + 1; goCar = goCar+","+gE('SVTestModelsbox2').value }
	if(gE('SVTestModelsbox3')) if(gE('SVTestModelsbox3').value) { total = total + 1; goCar = goCar+","+gE('SVTestModelsbox3').value }
	//alert(goCar);
	if(total >= 2)
	{
		$("#resultComp").load("/output.php?sec=ResultComp&shtml=1&data="+goCar+"&isEx="+isEx);
		$("#compbox").load("/output.php?sec=comp");
		gE("compareBox_dan").style.minHeight = "0px";
	}
	else alert('נא לבחור לפחות 2 גרסאות');
}

function SelectPic(id, ext, sheight)
{
	path = "/media/userfiles/models/gallery/";
	url = path+id+"_big."+ext;
	$("#MainPic").hide("slow",
		function()
		{
			$("#MainPic").attr("src", url);
			$("#MainPic").attr("height", sheight);
			$("#MainPic").show("slow");
		}
	);
}

function SelectLeasPic(id, ext, sheight)
{
	path = "/media/userfiles/leasing/models/gallery/";
	url = path+id+"_big."+ext;
	$("#MainPic").hide("slow",
		function()
		{
			$("#MainPic").attr("src", url);
			$("#MainPic").attr("height", sheight);
			$("#MainPic").show("slow");
		}
	);
}


function ModBox(id)
{
	if($("#ModBox"+id).css("display")=="none")
	{
		for(i=1; i<=4; i++)
		{
			if(i==id) 
			{
				$("#ModBox"+i).slideToggle("fast");
				$("#ModTop"+id).removeClass();
				$("#ModTop"+id).addClass("MoTitleB");
			}
			//else $("#ModBox"+i).hide("fast");
		}
	}
	else
	{
		$("#ModBox"+id).hide("fast");
		$("#ModTop"+id).removeClass();
		$("#ModTop"+id).addClass("MoTitle");
	}
}

function VerBox(id)
{
	if($("#VerBox"+id).css("display")=="none")
	{
		$("#VerBox"+id).slideToggle("slow");
		$("#VerTi"+id).removeClass();
		$("#VerTi"+id).addClass("MoTitleB");
	}
	else
	{
		$("#VerBox"+id).hide("slow");
		$("#VerTi"+id).removeClass();
		$("#VerTi"+id).addClass("MoTitle");
	}
}

function collapse(id)
{
	for(i=1; i<=5; i++)
	{
		if(id==0)
		{
			$("#VerBox"+i).hide("slow");
			$("#VerTi"+i).removeClass();
			$("#VerTi"+i).addClass("MoTitle");
			$("#collapse1").attr("src", "/images/openallo.jpg");
			$("#collapse0").attr("src", "/images/closeall.jpg");
			$("#collapse1").addClass("cursor");
			$("#collapse0").removeClass();
		}
		else
		{
			$("#VerBox"+i).show("slow");
			$("#VerTi"+i).removeClass();
			$("#VerTi"+i).addClass("MoTitleB");
			$("#collapse1").attr("src", "/images/openall.jpg");
			$("#collapse0").attr("src", "/images/closeallo.jpg");
			$("#collapse1").removeClass();
			$("#collapse0").addClass("cursor");
		}
	}
}

function collapse2(id)
{
	for(i=1; i<=5; i++)
	{
		if(id==0)
		{
			$("#VerBox"+i).hide("slow");
			$("#VerTi"+i).removeClass();
			$("#VerTi"+i).addClass("MoTitle");
			$("#collapse1").attr("src", "/images/copeno.jpg");
			$("#collapse0").attr("src", "/images/cclose.jpg");
			$("#collapse1").addClass("cursor");
			$("#collapse0").removeClass();
		}
		else
		{
			$("#VerBox"+i).show("slow");
			$("#VerTi"+i).removeClass();
			$("#VerTi"+i).addClass("MoTitleB");
			$("#collapse1").attr("src", "/images/copen.jpg");
			$("#collapse0").attr("src", "/images/ccloseo.jpg");
			$("#collapse1").removeClass();
			$("#collapse0").addClass("cursor");
		}
	}
}

function addComp(id)
{
	$.get("/output.php?sec=comp&action=add&id="+id,
		function ()
		{
			$("#compbox").load("/output.php?sec=comp");
			$("#compButtonT").load("/output.php?sec=comp&action=button&id="+id);
			$("#compButtonB").load("/output.php?sec=comp&action=button&id="+id);
		}
	);
}

function delComp(id)
{
	$.get("/output.php?sec=comp&action=delete&id="+id,
		function ()
		{
			$("#compbox").load("/output.php?sec=comp");
			$("#compButtonT").load("/output.php?sec=comp&action=button&id="+gE("versionID").innerHTML);
			$("#compButtonB").load("/output.php?sec=comp&action=button&id="+gE("versionID").innerHTML);
		}
	);
}

function SendComp()
{
	$("#CompSend").show("slow");
}

function gE (value)
{
	return document.getElementById(value);
}

// main logic that compares values of fields in the comparison engine
// which value is the best? comes from $performance_comp in /_inc/data.array.php
function doComp(name, status){
	//if(gE('h-'+name+'-0')==null) return false;
	var a='';
	var b='';
	var c='';
	if(gE('h-'+name+'-0')) a = gE('h-'+name+'-0').value;
	if(gE('h-'+name+'-1')) b = gE('h-'+name+'-1').value;
	if(gE('h-'+name+'-2')) c = gE('h-'+name+'-2').value;
	//$('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
	if(a.indexOf('.') > -1){
		a = parseFloat(a);
	}else{
		a = parseFloat(a);		
	}

	if(b.indexOf('.') > -1){
		b = parseFloat(b);
	}else{
		b = parseFloat(b);		
	}
	if(gE('h-'+name+'-2'))
		{
			if(c.indexOf('.') > -1){
				c = parseFloat(c);
			}else{
				c = parseFloat(c);		
			}
		}		
if(status=='1') // the highest parameter is the best
	
	{
		if(gE('h-'+name+'-2'))
		{
			if(a > b && a > c) $('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
			if(b > a && b > c) $('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
			if(gE('h-'+name+'-2'))
				if(c > a && c > b)
					$('#'+name+'-2').css({ "color": "#ff7200", "font-weight": "bold" });
		}
		else
		{   //alert("a= "+a+" b= "+b)
			if(a > b) $('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
			if(b > a) $('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
		}
		
		if(gE('h-'+name+'-2'))
		{
			if(a == b)
			{
				if(a > c) 
				{
					$('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
					$('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
				}
			}
			
			if(b == c)
			{
				if(b > a) 
				{
					$('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
					$('#'+name+'-2').css({ "color": "#ff7200", "font-weight": "bold" });
				}
			}
			
			if(a == c)
			{
				if(a > b) 
				{
					$('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
					$('#'+name+'-2').css({ "color": "#ff7200", "font-weight": "bold" });
				}
			}
		}
	}
	else if(status=='0') // the lowest parameter is the best
	{ if (name=='consumption') //alert ("a= "+a+" b= " +b+ "c= "+c)
		if(a=="-") a=9999999999999999;
		if(b=="-") b=9999999999999999;
		if(gE('h-'+name+'-2')) if(c=="-") c=9999999999999999;
		if(gE('h-'+name+'-2'))
		{
			if(a < b && a < c) $('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
			if(b < a && b < c) $('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
				if(c < a && c < b)
					$('#'+name+'-2').css({ "color": "#ff7200", "font-weight": "bold" });
		}
		else
		{
			if(a < b) $('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
			if(b < a) $('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
		}
		
		if(gE('h-'+name+'-2')) 
		{
			if(a == b)
			{
				if(a < c) 
				{
					$('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
					$('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
				}
			}
			
			if(b == c)
			{
				if(b < a) 
				{
					$('#'+name+'-1').css({ "color": "#ff7200", "font-weight": "bold" });
					$('#'+name+'-2').css({ "color": "#ff7200", "font-weight": "bold" });
				}
			}
			
			if(a == c)
			{
				if(a < b) 
				{
					$('#'+name+'-0').css({ "color": "#ff7200", "font-weight": "bold" });
					$('#'+name+'-2').css({ "color": "#ff7200", "font-weight": "bold" });
				}
			}
		}
	}
}

function checkBox(boxname)
{
	if(!document.getElementById(boxname+'0')){
		return true;
	}
	for(var i=0; document.getElementById(boxname+i); i++)
	{
		if(document.getElementById(boxname+i).checked)
		{
			return true;
		}
	}
	return false;
}

function doForm()
{
	if (document.modform.cur_model!=null && document.modform.cur_model!=undefined){
		cm = 1;
		//alert ("yes cur_model")
	}else{
		cm = 0;
		//alert ("no cur_model")
	}
	
	if (document.modform.fullname.value != ""){
		if(IsEmail(document.modform.email.value)==true){
			if (isInteger(document.modform.phone.value)){
				if (checkBox('adv')){
					if (document.modform.area && document.modform.area.value != ''){
						if (cm==1){
							if (document.modform.cur_model.value != ''){
								if(document.modform.is_sechand.value>-1){
									document.modform.submit();
								}else{alert("נא לבחור סוג רכב");}
							}else {alert("נא להזין דגם נוכחי");document.modform.cur_model.focus();}
						 }else {
							if (checkBox('newsletter')==true){
								if(document.modform.iski_prati){
									if(document.modform.iski_prati.value=='-1'){
										alert('נא לבחור סוג ליסינג');
									}else{document.modform.submit();}
								}else{document.modform.submit();}
							} else{ alert("האם אתה מעוניין בקבלת ניוזלטר? נא סמן תשובתך");document.getElementById('newsletter0').focus(); }
						 }
					}else{ alert("נא להזין אזור מגורים");document.modform.area.focus();}
				} else{ alert("נא לבחור לפחות אפשרות אחת"); }
			} else{ alert("נא לרשום מספר טלפון עם ספרות בלבד");document.modform.phone.focus(); }
		} else{ alert("נא לרשום דואר אלקטרוני חוקי");document.modform.email.focus(); }
	} else{ alert("נא לרשום שם מלא");document.modform.fullname.focus(); }
}
function doFormIM()
{
	if (document.modform.cur_model!=null && document.modform.cur_model!=undefined){
		cm = 1;
		//alert ("yes cur_model")
	}else{
		cm = 0;
		//alert ("no cur_model")
	}
	
	if (document.modform.fullname.value != ""){
		if(IsEmail(document.modform.email.value)==true){
			if (isInteger(document.modform.phone.value)){
				if (checkBox('adv')){
					if (document.modform.area && document.modform.area.value > -1){
						if (cm==1){
							if (document.modform.cur_model.value != ''){
								if(document.modform.is_sechand.value>-1){
									document.modform.submit();
								}else{alert("נא לבחור סוג רכב");}
							}else {alert("נא להזין דגם נוכחי");document.modform.cur_model.focus();}
						 }else {
							if (checkBox('newsletter')==true){
								if(document.modform.iski_prati){
									if(document.modform.iski_prati.value=='-1'){
										alert('נא לבחור סוג ליסינג');
									}else{document.modform.submit();}
								}else{document.modform.submit();}
							} else{ alert("האם אתה מעוניין בקבלת ניוזלטר? נא סמן תשובתך");document.getElementById('newsletter0').focus(); }
						 }
					}else{ alert("נא לבחור אזור מגורים");document.modform.area.focus();}
				} else{ alert("נא לבחור לפחות אפשרות אחת"); }
			} else{ alert("נא לרשום מספר טלפון עם ספרות בלבד");document.modform.phone.focus(); }
		} else{ alert("נא לרשום דואר אלקטרוני חוקי");document.modform.email.focus(); }
	} else{ alert("נא לרשום שם מלא");document.modform.fullname.focus(); }
}
function doFormTD()
{
	if (document.modform.fullname.value != ""){
		if(IsEmail(document.modform.email.value)==true){
			if (isInteger(document.modform.phone.value)){
					if (document.modform.area && document.modform.area.value != ''){
				//if (checkBox('adv')==true){
						if (checkBox('newsletter')==true){
							document.modform.submit();
						} else{ alert("האם אתה מעוניין בקבלת ניוזלטר? נא סמן תשובתך");document.getElementById('newsletter0').focus(); }
					}else{ alert("נא להזין אזור מגורים");document.modform.area.focus();}
				//} else{ alert("נא לבחור לפחות אפשרות אחת"); }
			} else{ alert("נא לרשום מספר טלפון עם מספרים בלבד"); document.modform.phone.focus()}
		} else{ alert("נא לרשום דואר אלקטרוני חוקי"); document.modform.email.focus()}
	} else{ alert("נא לרשום שם מלא"); document.modform.fullname.focus()}
}


function doFormTDIM()
{
	if (document.modform.fullname.value != ""){
		if(IsEmail(document.modform.email.value)==true){
			if (isInteger(document.modform.phone.value)){
					if (document.modform.area && document.modform.area.value> -1){
				//if (checkBox('adv')==true){
						if (checkBox('newsletter')==true){
							document.modform.submit();
						} else{ alert("האם אתה מעוניין בקבלת ניוזלטר? נא סמן תשובתך");document.getElementById('newsletter0').focus(); }
					}else{ alert("נא לבחור אזור מגורים");document.modform.area.focus();}
				//} else{ alert("נא לבחור לפחות אפשרות אחת"); }
			} else{ alert("נא לרשום מספר טלפון עם מספרים בלבד"); document.modform.phone.focus()}
		} else{ alert("נא לרשום דואר אלקטרוני חוקי"); document.modform.email.focus()}
	} else{ alert("נא לרשום שם מלא"); document.modform.fullname.focus()}
}

function isInteger (s)
{
  var i;

  if (isEmpty(s))
  if (isInteger.arguments.length == 1) return 0;
  else return (isInteger.arguments[1] == true);

  for (i = 0; i < s.length; i++)
  {
     var c = s.charAt(i);

     if (!isDigit(c)) return false;
  }

  return true;
}

function isEmpty(s)
{
  return ((s == null) || (s.length == 0))
}

function isDigit (c)
{
  return ((c >= "0") && (c <= "9"))
}

function doContact()
{
	if (document.contact.fullname.value != ""){
			if(IsEmail(document.contact.email.value)==true){
					document.contact.submit();
			}else{ 
					alert("נא לרשום דואר אלקטרוני חוקי");
					document.contact.email.focus();		
			 }
	} else{ 
			alert("נא לרשום שם מלא");
			document.contact.fullname.focus();
	 		}
}

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 SendMail()
{
	if (document.sendmail.fullname.value != ""){
		if(IsEmail(document.sendmail.email.value)==true){
				$("#sendmail").ajaxSubmit(
					function()
					{
						$("#CompSend").hide("slow");
						$("#CompSendMSG").fadeIn("slow");
						$("#CompSendMSG").html("<p>נשלח בהצלחה.</p>");
						setTimeout('$("#CompSendMSG").fadeOut("slow");', 3500)
					}
				);
		} else{ alert("נא לרשום דואר אלקטרוני חוקית"); }
	} else{ alert("נא לרשום שם מלא"); }
}

function Fullbox()
{
	alert("התיבה מלאה! אנא מחק אחת מהגרסאות על מנת להוסיף גרסה חדשה");
}

function Print()
{
	window.open ('/output.php?sec=Comparison','print','location=0,status=0,scrollbars=1,width=600,height=600');
}

function PrintArticle(artID)
{
	window.open ('/printArt.php?id='+artID,'printArt','location=0,status=0,scrollbars=1,width=750,height=600');
}

var cbArr = ['','0','1','2'];
function resetCompBorderHeight(cbPre)
{	
	// Check browser
	nav = navigator.userAgent.split(" ");
	nav = nav[0].split("/");
	
	// Get height value
	if(nav[0]=="Mozilla")
		max = gE('cb-'+cbPre).offsetHeight - 8;
	else
		max = gE('cb-'+cbPre).offsetHeight;
		
	// Change height value
	for (var i=0; i<cbArr.length; i++)
	{
		if (gE(cbPre+'-'+cbArr[i]))
		{
			gE(cbPre+'-'+cbArr[i]).style.height = (max)+'px';
		}
	}
	gE(cbPre).style.height = (max)+'px';
}

function launchLandingPage(model_id, landing_name, obj_id, obj_type, hand){
	if(typeof(obj_id) == 'undefined') var obj_id = 0;
	if(typeof(obj_type) == 'undefined') var obj_type = 'button';
	if(typeof(hand) == 'undefined') var hand = '1';
 	gotourl = "http%3A%2F%2Fwww.icar.co.il%2F"+landing_name+"%3Fmodel_id%3D"+model_id+"%26hand%3D"+ hand;
 	gotourl = "http://www.icar.co.il/ad_click.php?oid="+obj_id+"&otp="+obj_type+"&goto="+gotourl;
 
	PopW = window.open(gotourl,"PopUpWindow","width="+screen.width+",height="+screen.height+",top=10,left=20,resizable=no,scrollbars=yes,menubar=no,toolbar=no,status=no,location=no")
	
}


function getArticleResponses(id){
	$('#responses').load('/_ajax/responses.show.ajax.php?article_id='+id);
}

function checkFrmMistake(){	
	if (document.frmMistake.fullname.value != ''){
		if(IsEmail(document.frmMistake.email.value)==true){
			if(document.frmMistake.content.value!=''){
				return true;
			}else{alert('נא לציין את הטעות שמצאת.'); return false;}
		}else{alert('נא להזין כתובת אי-מייל.'); return false;}
	}else{alert('נא להזין שם'); return false;}
}
var mnID=moID=0;

function iskiPratiAction_old(iski_prati){
	var checkBox = gE('adv0');
	if(iski_prati=='ליסינג עסקי'){
		checkBox.value = 47;
	}else{
		checkBox.value = 38;
	}
}

function iskiPratiAction(iski_prati,mid,mdlname){
		if(mdlname=="NewLeasing"){
			if(iski_prati=='ליסינג עסקי'){
				document.location.href='/NewLeasing?iski_prati='+iski_prati+'&id=1&mid='+mid;
			}else{
				document.location.href='/NewLeasing?iski_prati='+iski_prati+'&id=1&mid='+mid;
			}
		}else{
			if(iski_prati=='ליסינג עסקי'){
				document.location.href='/output.php?sec=form&iski_prati='+iski_prati+'&id=1&mid='+mid;
			}else{
				document.location.href='/output.php?sec=form&iski_prati='+iski_prati+'&id=1&mid='+mid;
			}
		}
}