﻿//======================================================//
	function addLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
		window.onload = func;
	  } else {
		window.onload = function() {
		  if (oldonload) {
			oldonload();
		  }
		  func();
		}
	  }
	}
//======================================================//
	function AddLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
		window.onload = func;
	  } else {
		window.onload = function() {
		  if (oldonload) {
			oldonload();
		  }
		  func();
		}
	  }
	}
	
//======================================================//
function $(e){if(typeof e=='string')e=document.getElementById(e);return e};
function collect(a,f){var n=[];for(var i=0;i<a.length;i++){var v=f(a[i]);if(v!=null)n.push(v)}return n};
//======================================================//
ajax={};
ajax.x=function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}};
ajax.serialize=function(f){var g=function(n){return f.getElementsByTagName(n)};var nv=function(e){if(e.name)return encodeURIComponent(e.name)+'='+encodeURIComponent(e.value);else return ''};var i=collect(g('input'),function(i){if((i.type!='radio'&&i.type!='checkbox')||i.checked)return nv(i)});var s=collect(g('select'),nv);var t=collect(g('textarea'),nv);return i.concat(s).concat(t).join('&');};
ajax.send=function(u,f,m,a){var x=ajax.x();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x)};if(m=='POST')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a)};
ajax.get=function(url,func){ajax.send(url,func,'GET')};
ajax.gets=function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x};
ajax.post=function(url,func,args){ajax.send(url,func,'POST',args)};
ajax.update=function(url,elm){var e=$(elm);var f=function(r){e.innerHTML=r};ajax.get(url,f)};
ajax.submit=function(url,fun,frm){ajax.post(url,fun,ajax.serialize(frm))};
//======================================================//
//======================================================//
function WaterMark(id, opt, txt, flipDir)
{
	if($get(id).value == ""){$get(id).style.color=opt._onblur;$get(id).value=txt;}
	$get(id).onblur = function(){
		if($get(id).value==""){$get(id).value=txt}
		if($get(id).value==txt){$get(id).style.color=opt._onblur;if(flipDir){FlipDir(id,opt);}}
	};
	$get(id).onfocus = function(){
		if($get(id).value==txt){$get(id).value=""}
		$get(id).style.color=opt._onfocus;
		if($get(id).value==""){if(flipDir){FlipDir(id,opt);}}
	};
}
function FlipDir(id,opt)
{
	if($get(id).style.direction == "")
		$get(id).style.direction = opt.dir;
	if($get(id).style.direction == "rtl")
		$get(id).style.direction = "ltr";
	else
		$get(id).style.direction = "rtl";
}

//======================================================//
//======================================================//
function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}
//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function ChangePic2( pic)
{
//alert(pic)
	opacity('BPic', 40, 100, 400)
	setTimeout("DoChange2('" + pic + "')", 20);
}

function DoChange2(pic)
{
	document.getElementById("BPic").src =  pic
}
function Details_Handler(id,pid) {

	trDetailsopen = document.getElementById("trDetailsopen" + id);
	tdDetailsopen = document.getElementById("tdDetailsopen" + id);
	//alert(trDetailsclose)
	if(trDetailsopen.style.display == "none")
	{					
		trDetailsopen.style.display = "";
		tdDetailsopen.innerHTML = "<iframe align='left' id='ifr" + id + "' name='ifr" + id + "' frameborder='no' scrolling='no' src='Resume.asp?id=" + id + "&PID=" + pid + "' width='484' height='145' ></iframe>";				
	}
	else
	{
	
		tdDetailsopen.innerHTML = "";	
		trDetailsopen.style.display = "none";
	}	
}

	    function open_department(id)
	    {
	        document.getElementById("Dep" + id).style.display = 'none';
	        document.getElementById("DepOpen" + id).style.display = '';
	    }

	    function close_department(id)
	    {
	        document.getElementById("Dep" + id).style.display = '';
	        document.getElementById("DepOpen" + id).style.display = 'none';
	    }


	//====================================================\\
	function Clear(num)
	{
			
		if(document.getElementById("FreeText").value == "הקלד/י טקסט חופשי לחיפוש" && num==1)
			document.getElementById("FreeText").value = ""

	}
	//====================================================\\
	function Fill(num)
	{
			
		if(document.getElementById("FreeText").value == "" && num==1)
			document.getElementById("FreeText").value = "הקלד/י טקסט חופשי לחיפוש"
			
	}

	function CheckLogin()
	{
		un = document.getElementById("mUsername");
		pw = document.getElementById("mPassword");
		
		if(un.value == "" || un.value == "כתובת אימייל"){alert("אנא מלא כתובת אימייל"); return false; un.focus();}
		if(pw.value == ""){alert("אנא מלא סיסמה"); return false; pw.focus();}
		
		return true;
	}
	
	function Win(URL, name, width, height)
	{
		var x = screen.width;
		var y = screen.height;
		x=(x/2)-(width/2);
		y=(y/2)-(height/2);
		var wini = window.open(URL, name, "top="+y+",left="+x+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes");
		wini.window.focus();
	}
	
    var bookmarkurl="http://www.munch.co.il"
    var bookmarktitle="מאנצ' מור - מדריך המסעדות המלא"

    function addbookmark(){
    if (document.all)
    window.external.AddFavorite(bookmarkurl,bookmarktitle)
    }
//======================================================//
function EmailValid(val)
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(val);
}
//======================================================//

function FlipDir(id,opt)
{
	if($(id).style.direction == "")
		$(id).style.direction = opt.dir;
	if($(id).style.direction == "rtl")
		$(id).style.direction = "ltr";
	else
		$(id).style.direction = "rtl";
}
//======================================================//
function ClearDiv(divID)
{
	if($(divID))
		$(divID).innerHTML = "";
}
//======================================================//
function HideDiv(divID)
{
	if($(divID))
		$(divID).className = "hidden";
}
//======================================================//
function RefreshUpdatePanel(hiddenFieldID)
{
	var hiddenField = $(hiddenFieldID);
	if (hiddenField) {
		hiddenField.value = (new Date()).getTime();
		__doPostBack(hiddenFieldID,'');
	}
}
function FileName(obj, divID)
{
	if(obj.value != "")
	{
		document.getElementById(divID).innerHTML = obj.value.substring(obj.value.lastIndexOf('\\')+1);

	}
}
	function dispNew(id,one,two)
	{
	
	var isDisplaed=eval(id+".style.display");
	if (isDisplaed=='block')
	{
	
	document.getElementById("e").style.backgroundImage = "url(images/banner_" + id + ".jpg)";
	document.getElementById("d").style.backgroundImage = "url(images/" + id + ".jpg)";
	document.getElementById("tabs_" + id).src = "images/tabs_" + id + ".jpg";
	document.getElementById("tabs_" + one).src = "images/tabs_" + one + ".jpg";
	document.getElementById("tabs_" + two).src = "images/tabs_" + two + ".jpg";
	document.getElementById(id).style.display='block';
	document.getElementById(id + "t").style.display='block';
	document.getElementById(one).style.display='none';
	document.getElementById(one + "t").style.display='none';
	document.getElementById(two).style.display='none';
	document.getElementById(two + "t").style.display='none';
	document.getElementById("k").style.display='none';
	}
	else
	{
	document.getElementById("e").style.backgroundImage = "url(images/banner_" + id + ".jpg)";
	document.getElementById("d").style.backgroundImage = "url(images/" + id + ".jpg)";
	document.getElementById("tabs_" + id).src = "images/tabs_hover_" + id + ".jpg";
	document.getElementById("tabs_" + one).src = "images/tabs_" + one + ".jpg";
	document.getElementById("tabs_" + two).src = "images/tabs_" + two + ".jpg";
	document.getElementById(id).style.display='block';
	document.getElementById(id + "t").style.display='block';
	document.getElementById(one).style.display='none';
	document.getElementById(one + "t").style.display='none';
	document.getElementById(two).style.display="none";
	document.getElementById(two + "t").style.display='none';
	document.getElementById("k").style.display='none';
	}
	}
    function OverDomainDIV()
    {
        var str = "<iframe scrolling='no' frameborder='0' width='314' height='220' src='Domain.aspx' name='Domain' id='Domain'></iframe>"
        var str2 = "<iframe scrolling='no' frameborder='0' width='314' height='358' src='ShortContact.asp' name='ShortContact' id='ShortContact'></iframe>"
        document.getElementById('sDomainDIV').innerHTML = str;
        document.getElementById('sContactDIV').innerHTML = str2;
    }
    

function isEmailAddr(email)
{
var result = false
var theStr = new String(email)
var index = theStr.indexOf("@");
if (index > 0)
{
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
    result = true;
}
return result;
}

function CheckComments()
{
	var regx = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9_]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	
	frm = document.comment;
	if(frm.author_name.value == ""){alert("אנא מלא שם מלא");frm.author_name.focus();return false;}
	if (!regx.test(frm.email.value)){alert("כתובת האי-מייל שלך לא חוקית");frm.email.focus();return false;}
	document.getElementById("Secret").value = "lizzy";
	return true;
}

function CheckReComments()
{
	var regx = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9_]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	
	frm = document.ReComment;
	if(frm.author_name.value == ""){alert("אנא מלא שם מלא");frm.author_name.focus();return false;}
	if (!regx.test(frm.email.value)){alert("כתובת האי-מייל שלך לא חוקית");frm.email.focus();return false;}
	document.getElementById("Secret").value = "lizzy";
	return true;
}

	
    function OverResponseDIV(x,y,z)
    {
        var str = "<iframe scrolling='no' frameborder='0' width='616' height='280' src='Comments.asp?item_id="+x+"&FID="+y+"&typeID="+z+"' name='Comments' id='Comments'></iframe>"
        document.getElementById('sCommentsDIV' + x).innerHTML = str;
    }

    function CloseResponseDIV(x)
    {
        document.getElementById('sCommentsDIV' + x).innerHTML = '';
    }
	
	function isEmailAddr(email)
    {
    var result = false
    var theStr = new String(email)
    var index = theStr.indexOf("@");
    if (index > 0)
    {
	    var pindex = theStr.indexOf(".",index);
	    if ((pindex > index+1) && (theStr.length > pindex+1))
	    result = true;
    }
    return result;
    }

    function Checkfields(){
	
    if(document.all["ContactMan"].value==""){
    alert("שדה \"איש קשר\" חייב להיות מלא")
    document.all["ContactMan"].focus();
    return false;
    }

	
    if(document.all["Email"].value!="")
    {
    if (!isEmailAddr(document.all["Email"].value))
    {
	    alert(" yourname@yourdomain.com :אנא מלא כתובת אימייל תקנית");
	    document.all["Email"].focus();
	    return false;
    }
    if (document.all["Email"].value.length < 3)
    {
	    alert(" \"אימייל\" אנא מלא לפחות 3 תווים בשדה אימייל.");
	    document.all["Email"].focus();
	    return false;
    }	
    }
	
    if(document.all["Phone"].value==""){
    alert("שדה \"טלפון\" חייב להיות מלא")
    document.all["Phone"].focus();
    return false;
    }

    if(document.all["More"].value==""){
    alert("שדה \"הערות\" חייב להיות מלא")
    document.all["More"].focus();
    return false;
    }
	 document.all.Secret.value = "reuven"; 
     return true;
    }
    
function ForumMsg(id, type)
	{
		if(document.getElementById("trfBody"+id).style.display == "none")
		{
			document.getElementById("trfBody"+id).style.display = "";
			document.getElementById("imgForum"+id).className = "minus";
		}
		else
		{
			document.getElementById("trfBody"+id).style.display = "none";
			document.getElementById("imgForum"+id).className = "plus";
		}
	}

function CheckForm2()
	{
	    var oSubject = document.getElementById('oSubject');
		var oContent = document.getElementById('oBody');
		
		frm = document.forum;
		if(frm.txtAuthor.value == ""){alert("אנא מלא את שמך");frm.txtAuthor.focus();return false;}
		frm.txtSubject.value = oSubject.innerHTML;
		frm.txtMsg.value = oContent.innerHTML;
		return true;
	}

	function ChangeArrow2(id)
	{
	document.getElementById("arrow" + id).src = "images/spacer.gif";
	}

	function ChangeArrow(id)
	{
	document.getElementById("arrow" + id).src = "images/arrow128x75.png";
	}

                                                                function ChangeYouTubeTv(YouTubeID)
                                                                {
                                                                 
                                                                var objectStringMovie = "<object width='550' height='334'><param name='movie' value='http://www.youtube.com/v/"+YouTubeID+"&autoplay=1&hl=en&fs=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+YouTubeID+"&autoplay=1&hl=en&fs=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='550' height='334'></embed></object> "
                                                                document.getElementById("ObjectMovieCode").innerHTML = objectStringMovie;
                                                                }


