//----------------------------------dom------------------------------------
function uiPrev(input) {
    while (input) {
        input = input.previousSibling;
        if (input && input.nodeName != '#text')
            return input;
    }
}
function uiNullOrEmpty(value) {
    return (value==null || value=='');
}
function uiNext(input) {
    while (input) {
        input = input.nextSibling;
        if (input && input.nodeName != '#text')
            return input;
    }
}
function uiNextByAttribute(input,attribute_name,attribute_value) {
    while (input) {
        input = input.nextSibling;
        if (input && input.nodeName != '#text' && input.getAttribute(attribute_name) == attribute_value)
            return input;
    }
}
function uiPrevByAttribute(input,attribute_name,attribute_value) {
    while (input) {
        input = input.previousSibling;
        if (input && input.nodeName != '#text' && input.getAttribute(attribute_name) == attribute_value)
            return input;
    }
}
function uiParent(input) {
    if (input) 
        return input.parentNode;
}
function uiParentByAttribute(input,attribute_name,attribute_value) {
     while (input && input!=document) {
        if (input && input.getAttribute(attribute_name) == attribute_value)
            return input;
        input = input.parentNode;
    }
}
function uiSubParentByAttribute(input,attribute_name)
{
 while (input && input!=document) {
        if (input && input.getAttribute(attribute_name))
            return input;
        input = input.parentNode;
    }

}
function uiChilren(parent) {
    var chilren = [];
    if (parent) {
        var posibble_chilren = parent.childNodes;
        var len = posibble_chilren.length;
        for (var i = 0; i < len; i++)
            if (posibble_chilren[i].nodeName != '#text')
            chilren.push(posibble_chilren[i]);
    }
    return chilren;
}

function uiChilrenByAttribute(parent,children_tag,attribute_name,attribute_value) {
    var chilren = [];
    if (parent) {
        var tags=children_tag.split(',');
        for (var a = 0; a < tags.length; a++) {
            var posibble_chilren = parent.getElementsByTagName(tags[a]);
            var len = posibble_chilren.length;
            for (var i = 0; i < len; i++) {
                if (!attribute_name)
                    chilren.push(posibble_chilren[i]);
                else if (attribute_value == null) {
                    if (posibble_chilren[i].getAttribute(attribute_name) != null)
                        chilren.push(posibble_chilren[i]);
                } else {
                     if (posibble_chilren[i].getAttribute(attribute_name) == attribute_value)
                        chilren.push(posibble_chilren[i]);
               }
                
              }
        }
    }
    return chilren;
}
function $(id) {
    return document.getElementById(id);
}
function uiRadioSelected(parent_id) {
    var options=$(parent_id).getElementsByTagName('input');
	var selected;
	for (var i=0; i<options.length; i++)
		if (options[i].checked)
			return options[i];
	return null;
}
function uiEventElement(ev)
{
    ev = uiEvent(ev);
    if (!ev)
        return null;
        
    return ev.srcElement || ev.target;
}
function uiEvent(ev)
{
    ev = ev || window.event;
    return ev;
}
						
//----------------------------------positions------------------------------------

function uiMouseOffset(target, ev) {
    ev = uiEvent(ev);

    var docPos = uiGetPosition(target);
    var mousePos = uiMouseCoords(ev);
    return { x: mousePos.x - docPos.x, y: mousePos.y - docPos.y };
}

function uiGetPosition(e) {
    var left = 0;
    var top = 0;
    while (e) {
        left += e.offsetLeft;
        top += e.offsetTop;
        e = e.offsetParent;
    }
    return { x: left, y: top };
}

function uiGetAbsPosition(el) {
    var left = 0; //document.body.scrollLeft - document.body.clientLeft;
    var top = 0; //document.body.scrollTop - document.body.clientTop;
    if (el) {
        if (document.getBoxObjectFor) {
            var bo = document.getBoxObjectFor(el);
            left = bo.x;
            top = bo.y;
        }
        else if (el.getBoundingClientRect) {
        var rect = el.getBoundingClientRect();
            left = rect.left;
            top = rect.top;
        }
        else {
            while (el) {
                left += el.offsetLeft;
                top += el.offsetTop;
                el = el.offsetParent;
            }

        }
    }
        
    return {
        x: left, y: top
    };
}
function uiMouseCoords(ev) {
    if (ev.pageX || ev.pageY) {
        return { x: ev.pageX, y: ev.pageY };
    }
    return {
        x: ev.clientX + document.body.scrollLeft - document.body.clientLeft,
        y: ev.clientY + document.body.scrollTop - document.body.clientTop
    };
}
//----------------------------------drag and drop------------------------------------

var uiDraggedElement = null;
var uiDropTargets = null;

function uiStartDrag(item, ev) {

                
    if (!ev || !item)
        return;
    uiDraggedElement = uiParent(uiParent(item));
    uiDraggedElement.started=0;
    uiDraggedElement.seperator = uiNextByAttribute(uiDraggedElement, 'ui', 'box_sep');


    if (!uiDropTargets) {
        var parent_column = uiParentByAttribute(uiDraggedElement, 'ui', 'columns');
        uiDropTargets = uiChilrenByAttribute(parent_column, 'div', 'ui', 'box_sep');
    }
    //drop Targets
    if (!uiDraggedElement.dropTargets)
    {
        var col = 's';
        if ((parseInt(uiDraggedElement.getAttribute('tabs_count'))>2) ||
            (uiDraggedElement.getAttribute('id') == 'box_mouse'))
            col = '';
        var parent_column = uiParentByAttribute(uiDraggedElement, 'ui', 'column' + col);

        if (col == 's') {
            uiDraggedElement.dropTargets = uiDropTargets;
        } else {
            uiDraggedElement.dropTargets = new Array();
            var possibleTargets = uiChilren(parent_column);
            var len = possibleTargets.length;
            for (var i = 0; i < len; i++) {
                if (possibleTargets[i].getAttribute('ui') == 'box_sep')
                    uiDraggedElement.dropTargets.push(possibleTargets[i]);
            }
        }
    }
    //color drop zones
    var len = uiDraggedElement.dropTargets.length;
    for (var i = 0; i < len; i++) {
        var dropTarget = uiDraggedElement.dropTargets[i];
        //dropTarget.last_className = dropTarget.className;
        dropTarget.className = 'seperator_dropable';
    }
    
    //get mouse Offset
    uiDraggedElement.mouseOffset = uiMouseOffset(uiDraggedElement, ev);
    //set document on mouse events
    document.onmousemove = uiDrag;
    document.onmouseup = uiDrop;
    return false;
}
function uiDrag(ev) {
    if (uiDraggedElement) {
        ev = uiEvent(ev);
        var mousePos = uiMouseCoords(ev);
        if (!uiDraggedElement.started) {
            uiDraggedElement.seperator.style.display = 'none';
            uiDraggedElement.style.border = 'solid 1px #6699FF';
            if (uiBrowser=='firefox2' || uiBrowser=='explorer')
                uiDraggedElement.style.width = (uiDraggedElement.offsetWidth)+'px';
            uiDraggedElement.style.maxWidth='356px';    
            uiDraggedElement.style.position = 'absolute';
            uiDraggedElement.started = 1;
        }
        var mainContentScroll=(uiBrowser=='explorer' ? 0 :$('mainContent').scrollTop);
        
        uiDraggedElement.style.top = (mousePos.y -mainContentScroll- uiDraggedElement.mouseOffset.y ) + 'px';
        uiDraggedElement.style.left = (mousePos.x - uiDraggedElement.mouseOffset.x - (uiBrowser=='explorer'?document.body.scrollLeft:0) ) + 'px';

        if (uiDraggedElement.curTarget) {
            uiDraggedElement.curTarget.style.backgroundColor = ''; 
            uiDraggedElement.curTarget = null;
        }
        if (uiBrowser=='explorer')
            mousePos.y -= document.body.scrollTop - document.body.clientTop;
            
        for (var i = 0; i < uiDraggedElement.dropTargets.length; i++) {
            var curTarget = uiDraggedElement.dropTargets[i];
            var targPos = uiGetAbsPosition(curTarget);
            var targWidth = parseInt(curTarget.offsetWidth);
            var targHeight = parseInt(curTarget.offsetHeight);

            if ((mousePos.x > targPos.x-100)
                && (mousePos.x < (targPos.x + targWidth+100))
                && (mousePos.y > targPos.y-mainContentScroll - 50)
                && (mousePos.y < (targPos.y-mainContentScroll+ targHeight)+50)) {
                curTarget.style.backgroundColor = '#6699FF';
                uiDraggedElement.curTarget = curTarget;
                break;
            }
        }

        return false;
    }
}

function uiDrop() {
var flag=false;
    //restore drop zones color
    if (uiDropTargets) {
        var len = uiDropTargets.length;
        for (var i = 0; i < len; i++) {
            uiDropTargets[i].className = 'seperator';
        }
    }
  
    if (uiDraggedElement) {
    
        if (uiDraggedElement.curTarget) {
        flag=uiRegenerateBox(uiDraggedElement);
            uiDraggedElement.curTarget.parentNode.insertBefore(uiDraggedElement.seperator, uiDraggedElement.curTarget);
            uiDraggedElement.curTarget.parentNode.insertBefore(uiDraggedElement, uiDraggedElement.curTarget);
            uiDraggedElement.curTarget.style.backgroundColor = '';
            /*
            var order_arr = uiOrderCurr.split(',');
            for (var i=0; i<order_arr.length; i++)
            {
                if (order_arr[i] == uiDraggedElement.seperator.id)
                    order_arr[i]=uiDraggedElement.curTarget.id;
                else if (order_arr[i] == uiDraggedElement.curTarget.id)
                    order_arr[i]=uiDraggedElement.seperator.id;
            }    
            var uiOrderCurr2=uiOrderCurr;
            uiOrderCurr=order_arr.join(',');
            */
            var order=uiGetCookie('box_order');
            if (!order)
                order='';
            order+=',' + uiDraggedElement.seperator.id + '-' + uiDraggedElement.curTarget.id;
            uiSetCookie('box_order',order,0);
        }

        if ((uiBrowser=='firefox2' || uiBrowser=='explorer')&&!flag)
            uiDraggedElement.style.width = '';
        uiDraggedElement.style.position = 'static';
        var x = uiDraggedElement;
        window.setTimeout(function() {
            x.style.border = 'solid 1px #ffffff';
        }, 500);
        uiDraggedElement.seperator.style.display = 'block';
        uiDraggedElement.seperator.style.width = '';
         uiRegenerateBox(uiDraggedElement);
        uiResetPageTimeout();
        uiDraggedElement = null;
        document.onmousemove = null;
        document.onmouseup = null;
    }
}
function uiRegenerateBox(uiDraggedElement)
{var resch; var cont;
 if(uiDraggedElement.getAttribute('regbox'))
 {
 uiDraggedElement.seperator=$("sepbot_"+uiDraggedElement.getAttribute('regbox'));
 uiDraggedElement.seperator.style.display = 'block';
 uiDraggedElement.style.width='100%';
 uiDraggedElement.style.maxWidth='358px';
 var sibling=uiNextByAttribute(uiDraggedElement,'rb','1');
 if(!sibling)seebling=uiPrevByAttribute(uiDraggedElement,'rb','1');
 if(sibling)
 {
  var order=uiGetCookie('box_order');
  sibling.style.width='100%';
  sibling.seperator=$("sepbot_"+sibling.getAttribute('regbox'));
  sibling.seperator.style.display = 'block';
  order+=',' + sibling.seperator.id + '-' + sibling.seperator.id;
  uiSetCookie('box_order',order,0);
  cont=uiChilrenByAttribute(sibling,'div','is_tab_content','1');
   if(cont&&cont[0])
   cont[0].className='box_contentadv';
  resch=uiChilrenByAttribute(sibling,'div,span','res','1');
  
for(var i=0;i<resch.length;i++)
{
resch[i].style.width='75%';
if(i==0)
resch[i].style.width='99%'
}

 }
   cont=uiChilrenByAttribute(uiDraggedElement,'div','is_tab_content','1');
   if(cont&&cont[0])
   cont[0].className='box_contentadv'; 
resch=uiChilrenByAttribute(uiDraggedElement,'div,span','res','1');
for(var i=0;i<resch.length;i++)
{
resch[i].style.width='75%';
if(i==0)
resch[i].style.width='99%'
}

 return true;
 }
 return false;
 
}


function uiLoadAsync(url,body, dataLoadedFunction) {
    var xmlHttp = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'));
    xmlHttp.open((body?'POST':'GET'), url, true);
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            var response = xmlHttp.responseText || (xmlHttp.responseXml && xmlHttp.responseXml.xml);
            if (dataLoadedFunction)
                dataLoadedFunction((response ? response : ''));
        }
    }
    // send
    xmlHttp.send(body);
}

//----------------------------------tabs------------------------------------
function uiGetEventTab(ev) {
    var target = uiEventElement(ev);
    if (!target)
        return null;
    if (!target.getAttribute('tab'))
        target = target.parentNode;
    if (uiNullOrEmpty(target.getAttribute('tab')))
        return null;
    return target;
}
function uiTabOver(ev) {
    var target = uiGetEventTab(ev);
    if (target)
        target.timer = window.setTimeout(function() {uiTabClick(null,target);},400);
}
function uiTabOut(ev) {
    var target = uiGetEventTab(ev);
    if (target && target.timer)
        window.clearTimeout(target.timer);
}
function uiTabClick(ev,target) {
    
    if (!target)
         target = uiGetEventTab(ev);
    if (!target)
        return;
        
    uiResetPageTimeout();
    var box = uiParentByAttribute(target, 'has_tabs', '1');
    //
    if (!box)
        return;
    if (!box.tabs) 
        box.tabs = uiChilrenByAttribute(box, 'div', 'tab');
    if (!box.last_selected)
        box.last_selected = box.tabs[0];
    if (box.last_selected == target)
        return;
    if (!box.contents)
        box.contents = uiChilrenByAttribute(box, 'div', 'is_tab_content');
         var chplay=new Array();
  for( var i=0;i<box.contents.length;i++)
  {
  if(box.contents[i].getAttribute('purp')!=null)
    {
    box.contents.splice(i,1);break;
    }
  
  }
 

    var tab_pos = parseInt(target.getAttribute('tab')) - 1;
    if (tab_pos < 0 || tab_pos >= box.contents.length)
        return;
    //
  
    target.className = 'tab_selected';
    box.last_selected.className = 'tab';
    var last_tab_pos = parseInt(box.last_selected.getAttribute('tab')) - 1;
    var last_selected_content = box.contents[last_tab_pos];
    box.current_tab_content=box.contents[tab_pos];
   
    box.current_tab_content.className = box.current_tab_content.className.replace('_hidden', '');
    last_selected_content.className = last_selected_content.className+('_hidden');
    if (box.current_tab_content.getAttribute('has_text') != '1')
    {
        box.current_tab_content.setAttribute('has_text', '1');
       // curren    t_tab_content.style.width=current_tab_content.offsetWidth;
       var current_tab_content=box.current_tab_content;
       uiLoadAsync('test.aspx?model=' + uiParams.model + '&action=Content_GetByTabId&tab_id=' + target.getAttribute('id') + "&titlernd="+Math.round(Math.random()*1000000)
        , null
        , function(response) {
            current_tab_content.innerHTML = response;
            uiLoadImages(current_tab_content);
        });
    }
    
    if (box.className=='box') //show or hide seperator
    {
        if (target != box.tabs[0])
            uiPrev(target).lastChild.className = '';

        if (box.last_selected != box.tabs[0])
            uiPrev(box.last_selected).lastChild.className = 'box_tab_left';
    }
    
    box.last_selected = target;
         
    return false;
}

//----------------------------------cookies------------------------------------
function uiSetCookie(name,value,days) {
	var date = new Date();
	if (days && days>0)
	    date.setTime(date.getTime()+(days*24*60*60*1000));
	else
	    date.setTime(date.getTime()+(665*24*60*60*1000));
	document.cookie = name + '=' + escape(value) + '; path=/; expires=' + date.toGMTString();
}

function uiGetCookie(name)
{
    if (document.cookie)
    {
        var cookies = document.cookie.split('; ');
        var len = cookies.length;
        for (var i=0; i<len; i++)
        {
            if (cookies[i])
            {
                var name_value = cookies[i].split('=');
                if (name==name_value[0])
                    return unescape(name_value[1]);
            }
        }
    }
    return '';
}


//----------------------------------engines------------------------------------

function uiAddStyle(theme) {
    var head = document.getElementsByTagName('head')[0];
    var cssNode = document.createElement('link');
    cssNode.type = 'text/css';
    cssNode.rel = 'stylesheet';
    cssNode.href = 'css/' + theme + '.css';
    cssNode.media = 'screen';
    cssNode.id = 'css_' + theme;
    head.appendChild(cssNode);
}

function uiRemoveStyle(theme) {
    var css = $('css_'+theme);
    if (css)
    {
        css.href = '';
        css.parentNode.removeChild(css);
    }
}


function uiOnload() {
    uiLoadImages(document);
   
}
function getFacebookUrl()
{
$('facebook_frame').src ='http://www.facebook.com/plugins/like.php?href='+window.location+'&layout=button_count&show_faces=true&width=100&action=like&font=arial&colorscheme=light&height=21';
}
function uiUserClicks(ev)
{
    uiResetPageTimeout();
    var link = uiEventElement(ev);
     if (link && link.tagName=='IMG')
         link=link.parentNode;
      var link_name = '';  
       var url = '';
        var sup_tab;
        var rss;
    if (link && (link.tagName=='A'||link.tagName=='SPAN')||link.getAttribute('statid'))
    {
        var tab_content = uiParentByAttribute(link, 'is_tab_content', '1');
       
        if (tab_content)
        {   link_name=tab_content.getAttribute('statid');
            if(!link_name)
            link_name = tab_content.getAttribute('tab_id');
            if (!link_name)
                link_name = tab_content.id;
            link_name=link_name.replace('tab_','');
            sup_tab=uiSubParentByAttribute(tab_content,'stat');
            if(sup_tab)
            link_name=' '+sup_tab.getAttribute('stat')+'  '+link_name;
            var sub_tab=uiSubParentByAttribute(link,'purp');
            if(sub_tab)
            link_name=link_name+' '+sub_tab.getAttribute('purp')+' ';
           
        }
         if(link&& link.getAttribute('statid')&&!tab_content)
         {
          link_name=link.getAttribute('statid');
          var sup_tab=uiSubParentByAttribute(tab_content,'stat');
          if(sup_tab)
          link_name=' '+sup_tab.getAttribute('stat')+' '+link_name;
          url='הקלקת טאב';
         }
        
        if(link.tagName=='SPAN')
        {
        rss = link.getAttribute('id');
        }
        if(link.tagName=='A'&&link.getAttribute('Inlink')&&link_name&&sup_tab)
        {
        link_name=link_name+' לינקים ';
         url=' '+(link.innerText || link.textContent || link.href);
        }
        if(link.tagName=='A'&&link.getAttribute('purp')&&link_name)
        {
        link_name=' שורה כתומה  '+link_name+' ';
         url=(link.innerText || link.textContent || link.href)+' '+link.getAttribute('purp')+' ';
        }
        else if(!rss)
        {
        
         rss = link.getAttribute('rss');
        }
        if(link.tagName=='A'&&link.getAttribute('get')&&link_name)
        {
         link_name=' שורה כתומה  '+link_name+' ';
         url=link.getAttribute('get');
        }
        if (rss)
            url+=rss+' ';
        var pos = link.getAttribute('pos');
        if (pos)
        {  if(url=='')
            url +=(link.innerText || link.textContent || link.href);
            url+=' לינק ' + pos;
            
        }
        else
        {
           if(url=='')
            url +=' '+(link.innerText || link.textContent || link.href);
            url=url.replace('\n',' ');
        }
        
        if (url && url.length>50)
            url=url.substring(0,50);
            
        if (link.id=='header_search_link')
        {
            url = ' חיפוש ';
            var tabs = $('header_tabs');
            if (tabs && tabs.last_tab)
                url+= (tabs.last_tab.innerText || tabs.last_tab.textContent);
            link_name='האדר';
        }
         if (link.id=='footer_search_link')
        {
            url = ' חיפוש ';
            var tabs = $('header_tabs');
            if (tabs && tabs.last_tab)
                url+= (tabs.last_tab.innerText || tabs.last_tab.textContent);
            link_name='פוטר';
        }
        if (!url)
            url='לא ידוע';
        url=url.replace('\n',' ');
        if(link.parentNode.className.indexOf('subheader_link')>0)
           {
            link_name='כותרת ראשית';
            if(link.children.length>0&&link.children[0].tagName=='IMG')
            url=link.children[0].alt;
           }
        
        
       
        if (!link_name)
         {
            var sub_tab=uiSubParentByAttribute(link,'purp');
            if(sub_tab)
            link_name=link_name+' '+sub_tab.getAttribute('purp')+' ';
           
         }
         var supplier=link.getAttribute('supplier');
         if(!supplier||supplier==null)
         supplier='';
         
         if(url!=''&&url!='•'&&url!=' •'&&url!='• '&&link.className!='box_content' )
         {
         pageTracker._trackPageview(link_name+":"+url+":"+supplier);   
         
         uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(url)+'&supplier='+escape(supplier));
         }
    }
}

function uiLoadImages(parent) {
    var images = uiChilrenByAttribute(parent,'img','nsrc');
    var len = images.length;
    for (var i=0; i<len; i++)
    {
        images[i].src = images[i].getAttribute('nsrc');
        images[i].removeAttribute('nsrc');
    }
    
}

function uiHideAdult()
{
    uiSetCookie('hideAdultContent','true',0);
    uiRemoveStyle('adult');
}
function uiMoveBoxAfter(sep_id_to_move,sep_id_reffernce) {
    var seperator_to_move = $(sep_id_to_move);
    if (!seperator_to_move)
        return;
        
        
    var box_to_move = uiPrev(seperator_to_move);
    if(seperator_to_move.getAttribute('regsep'))
    box_to_move=uiPrevByAttribute(seperator_to_move,'regbox',seperator_to_move.getAttribute('regsep'));
    if (!box_to_move)
        return;
    var seperator_ref = $(sep_id_reffernce);
    if (!seperator_ref)
        return;
    uiParent(seperator_ref).insertBefore(seperator_to_move, seperator_ref);
    uiParent(seperator_ref).insertBefore(box_to_move, seperator_ref);
    if(box_to_move.getAttribute('regbox'))
    {
    box_to_move.style.width='100%';
    seperator_to_move.style.display='block';
   var  cont=uiChilrenByAttribute(box_to_move,'div','is_tab_content','1');
   if(cont&&cont[0])
   cont[0].className='box_contentadv'; 
   var resch=uiChilrenByAttribute(box_to_move,'div,span','res','1');
for(var i=0;i<resch.length;i++)
{
resch[i].style.width='75%';
if(i==0)
resch[i].style.width='99%'
}
    }
}


function uiSortBoxes(box_order) 
{
    var arr=box_order.split(',');
    for (var i=1; i<arr.length; i++)
    {
        var arr2=arr[i].split('-');
        if (arr2.length==2)
            uiMoveBoxAfter(arr2[0],arr2[1]);
    }
    /*
    if (current.length == desired.length) 
    {   
        var len = current.length;
        for (var i=0; i<len; i++)
        {
            if (current[i]!=desired[i])
            {
                for (var j=0; j<len; j++)
                    if (desired[i]==desired[j])
                    {
                        if (j>0)
                            uiMoveBoxAfter(desired[j-1],desired[j]);
                        break;
                    }
            }
        }
    }
    */
}


function uiPostToNewWindow(url, fields)
{
    var form = $('engineForm');
    form.action = url;
     for(var field in fields)
     {
        form.innerHTML += '<input type="hidden" name="' + field + '" value="' + eval('fields["' + field + '"]') + '" />';
        }
    
    form.submit();
}
function uiHeaderTabClick(ev)
{
    var tab = uiEventElement(ev);
    var tabs = $('header_tabs');
    if (!tab || !tabs)
        return;    
    if (tab.className!='header_tab') 
        return;
        
    tab.className='header_tab_selected'
    if (!tabs.last_tab)
        tabs.last_tab = $('first_header_tab');

    tabs.last_tab.className='header_tab';
    tabs.last_tab=tab;
    if(tab.getAttribute('key')!='web'&&tab.getAttribute('key')!='pics'&&tab.getAttribute('key')!='news'&&tab.getAttribute('key')!='translation')
      $('header_input').className='header_search_input_empty';
    else
    $('header_input').className='header_search_input';
   if(tab.getAttribute('key')=='shop')
    $('header_input').className='header_search_input_P1000';
}

function uiHeaderSearch(from_input)
{
  

    var tabs = $('header_tabs');
    if (!tabs)
        return false;    
        
    if (!tabs.last_tab)
        tabs.last_tab = $('first_header_tab');

    var selectedSite = tabs.last_tab.getAttribute('key');
    var val = $('header_input').value;

    var link;
    switch (selectedSite) 
    {
         case 'wiki':
            link = 'http://he.wikipedia.org/wiki/%D7%9E%D7%99%D7%95%D7%97%D7%93:Search?search=' + val + '&fulltext=%D7%97%D7%A4%D7%A9';
            break;
        
        case 'translation': 
            link ='http://translate.google.co.il/translate_t?prev=hp&hl=iw&js=y&text='+val+'&file=&sl=iw&tl=en&history_state0=#';
            break;
       
        case 'pics':
            link = 'http://images.google.co.il/images?hl=iw&q=' +val;
            document.charset = 'UTF-8';
            break;
       
        case 'shop':
            link = 'http://www.p1000.co.il/Site/searchresults.aspx?SearchText='+encodeURIComponent(val)+'&came=314';
              document.charset = 'UTF-8';
            break;
       
        case 'news':
            link = 'http://news.google.co.il/news?hl=iw&um=1&ie=UTF-8&sa=N&tab=wn&q=' + escape(val);
            break;
        case 'netex':
            link = 'http://www.netex.co.il/DisplayManager.aspx?searchPhrase='+escape(val)+'&lang=2~rtl&ssid=23&indexVersion=start';
            break;
    }
   document.charset = 'UTF-8';
   
   if (uiParams.model=='search' && link)
   {
        document.location.href=link;
        return false;    
   }
   else if (link)
   {
        window.open(link);
        return false;    
    }
    else if (!from_input)
    {
        $('cse-search-box').submit();
        return false;    
    }        
    return true;    
}
function uifooterSearch(from_input)
{
  $('cse-search-boxf').submit();
  return false;    

}
function uiEnterPressed(ev)
{
    if (!ev)
        ev=window.event;
    if (ev && ev.keyCode==13)
        return true;
    else
        return false;
}


function uiEngines_GetSubItems(e, rss_id, subItems, xath) {   
    var option = e.options[e.selectedIndex];
    if (option.cach)
    {
        $(subItems).innerHTML = option.cach;
        return;
    }
    if (!e.value)
    {
        $(subItems).innerHTML = '<select  ><option></option></select>';
        return;
    }
    
    

    $(subItems).innerHTML = '<select  ><option>המתן...</option></select>';   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Content_GetRssSubItems&rss_id=' + rss_id + '&xpath=' + escape(xath)
            , null
            , function(response) {
                option.cach = response;
                $(subItems).innerHTML = response;
                if (response && $(subItems).firstChild && $(subItems).firstChild.onchange)
                    $(subItems).firstChild.onchange();
            });
}
var popWin=null;
function uiShowPopup(url)
{
    popWin=window.open (url,
            "mywindow","location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=600"); 

    //$('popup_div').style.display='block';
   // var pos = uiGetPosition($('footer'));
   // $('popup_iframe').src=url;
   // $('popup_div').style.top = (pos.y-400) +'px';
}
function uiHidePopup()
{
    if (popWin)
        popWin.close();
    //$('popup_div').style.display='none';
}

function uiWriteScript(url)
{
    url=url.replace('$random$', Math.round(Math.random()*1000000) );
    document.write ('<s' + 'cript type="text/javascript" src="' + url +'"></s' + 'cript>');
}
function uiAppend(url,block)
{
url=url.replace('$random$', Math.round(Math.random()*1000000) );   
 $(block).innerHtml='<s' + 'cript type="text/javascript" src="' + url +'"></s' + 'cript>';
}
function uiWriteIframe (width,height,src,id,name)
{
     
     src=src.replace('$random$', Math.round(Math.random()*1000000) );
     document.write("<IFRAME WIDTH='" + width + "' HEIGHT='" + height + "px' name='"+name+"' id='"+id+"' MARGINWIDTH='0' MARGINHEIGHT='0' FRAMEBORDER='0' allowtransparency='true' background-color='transparent' SCROLLING='no' SRC='" + src + "'></IFRAME>");
}

function uiGetStyleClass (className) {
    var styleSheets_length=document.styleSheets.length;
	for (var s = 0; s < styleSheets_length; s++)
	{
	    var rules=(document.styleSheets[s].rules?document.styleSheets[s].rules:document.styleSheets[s].cssRules);
	    var rules_length=rules.length;
		for (var r = 0; r < rules_length; r++)
		{
			if (rules[r].selectorText == '.' + className)
				return rules[r];
		}
	}
	return null;
}

function uiShowLinks(link, show)
{
    var tab_content = uiParentByAttribute(link, 'is_tab_content', '1');
    if (!tab_content)
        return;
    if (!tab_content.extra_links)
         tab_content.extra_links=uiChilrenByAttribute(tab_content,'div','ui','extra_link');
         
    var len = tab_content.extra_links.length;
    for (var i=0; i<len; i++)
         tab_content.extra_links[i].style.display=(show ? 'block' : 'none');
         
    if (show)
        uiNext(link).style.display='block';
    else
        uiPrev(link).style.display='block';
    link.style.display='none';
}

function uiShowLinksAdd(link,show,id,style)
{
  uiShowLinks(link,show);
  $(id).style.display=style;
  
}

function uiGetMoreContent(link) {
    var content = uiParentByAttribute(link, 'is_tab_content', '1');
    
    if (content.more_div && content.more_div.interval)
        window.clearInterval(content.more_div.interval);
    if (content.minus) {
        link.title = link.title.replace('פחות','עוד');
        link.innerHTML = '[+]';
        content.minus = null;
        content.more_div.curr_height = content.more_div.offsetHeight;
        content.more_div.style.height = '';
        content.more_div.innerHTML = '';
        if (uiBrowser=='explorer') {
            content.more_div.to_height = content.more_div.offsetHeight;
            animateHeight(content.more_div);
        }
        else
            content.more_div.style.display = 'none';
        
            return;
    }
    content.minus = 1;
    content.more_div = uiChilrenByAttribute(content, 'div', 'ui', 'more_content')[0];
    link.innerHTML = '[-]';
    link.title = link.title.replace('עוד','פחות');
    content.more_div.style.display = 'block';
    
    if (content.more_div.cache)
    {
        content.more_div.curr_height = content.more_div.offsetHeight;
        content.more_div.style.height = '';
        content.more_div.innerHTML = content.more_div.cache;
        if (uiBrowser=='explorer') {
            content.more_div.style.overflow = 'hidden';
            content.more_div.to_height = content.more_div.offsetHeight;
            animateHeight(content.more_div);
        }
    }
    else {
        content.more_div.innerHTML = '<div style="padding:5px;"><img src="images/box/AjaxIndicator.gif" height="25"/></div>';
        uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Content_GetMoreContent&tab_id=' + content.getAttribute('tab_id')
                , null
                , function(response) {
                    content.more_div.curr_height = content.more_div.offsetHeight;
                    content.more_div.style.height = '';
                    content.more_div.innerHTML = response;
                    
                    uiLoadImages(content.more_div);
                    content.more_div.cache=content.more_div.innerHTML;
                    
                    if (uiBrowser=='explorer') {
                        content.more_div.style.overflow = 'hidden';
                        content.more_div.to_height = content.more_div.offsetHeight;
                        animateHeight(content.more_div);
                    }
                });
    }
}

function animateHeight(content) {
    content.style.height = content.curr_height + 'px';
    var dir = 6;
    if (content.to_height < content.curr_height)
        dir = -6;
    content.interval = window.setInterval(function() {
        content.curr_height += dir;
        if (content.curr_height>=0)
            content.style.height = content.curr_height + 'px';
        if (dir > 0 && content.to_height <= content.curr_height)
            window.clearInterval(content.interval);
        if (dir < 0 && content.to_height >= content.curr_height) {
            content.style.display = 'none';
            window.clearInterval(content.interval);
        }
    }, 20);
}
function uiVideoPage(ev)
{
    var target=uiEventElement(ev);  
    if (!target)
            return;
    var className= target.className;
    if (className=='videos_footer_next' || className=='videos_footer_prev')
    {
        var tab_content = uiParentByAttribute(target,'is_tab_content','1');
        var page = uiChilrenByAttribute(tab_content,'div','ui','page')[0];
        if (!page)
            return;
        var minLine=(parseInt(page.getAttribute('minLine'))+3*(className=='videos_footer_prev'?-1:1));
        if (minLine<0)
            return;
        
        var status = uiChilrenByAttribute(tab_content, 'div', 'ui', 'status')[0];
        status.style.display = '';
        
        uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Content_GetMoreContent&tab_id=' + tab_content.getAttribute('tab_id')
                                            + '&minLine=' +minLine
            , null
            , function(response) {
                page.parentNode.innerHTML = response;
                uiLoadImages(tab_content);
                page = uiChilrenByAttribute(tab_content,'div','ui','page')[0];
                var prev = uiChilrenByAttribute(tab_content,'div','ui','prev')[0];
                var next = uiChilrenByAttribute(tab_content,'div','ui','next')[0];
                status.style.display = 'none';
                prev.style.display = (page.getAttribute('prev') == '1' ? '' : 'none');
                next.style.display = (page.getAttribute('next')=='1'?'':'none');
            });
    }
}



function uiSetHome()
{
    document.body.style.behavior='url(#default#homepage)'; 
    document.body.setHomePage(window.location.href);
}
function uiAddToFavorites()
{
    if (window.external) {
        window.external.AddFavorite( window.location.href, 'fun.start.co.il');
    } else if (window.sidebar) {
    //alert('FIREFOX!');
        window.sidebar.addPanel('fun.start.co.il', window.location.href,'');
    }  
}
function uiResetPage()
{
    uiSetCookie('box_order','',0);
    uiSetCookie('hideAdultContent','false',0);
    uiSetCookie('seenPlazma','false',0);
    document.location.reload();
}
function uiGoToOld()
{
    uiSetCookie('IsNewSiteUser','false',0);
    document.location.href='http://www.1.start.co.il/?cameFromNewSite=1';
}
var uiSideAdByWidthTimeout=null;
var uiOzen=null;
function uiSideAdByWidth()
{
    if (uiSideAdByWidthTimeout)
        window.clearTimeout(uiSideAdByWidthTimeout);
        
    if (uiOzen.hidden_by_plazma)
        return;
        
    var uiSideAdByWidthTimeout = window.setTimeout(
        function() {
            var width = (document.body.clientWidth || window.innerWidth);
            var show = (width>1016);
            uiOzen.style.display = (show ? '' : 'none');
            var pad = (show && width<1110);
            var ozenZeroLeft = (width<1170);
            if (show)
                uiOzen.style.left = (ozenZeroLeft?'0px':'40px');
                
            if (uiBrowser=='explorer')
                $('mainContent').style.paddingLeft = (pad?'120px':'0px');
            else
                $('main').style.paddingLeft = (pad?'120px':'0px');
        }
        ,500
    )
}
//-------------engines 
function uiEngines_email_submit()
{
	var selected=uiRadioSelected('email_options');
	if (!selected)
		return;
	var email_user=$('email_user').value;
	var email_pwd=$('email_pwd').value;
	var engineUrl, parameters;
	
	switch (selected.value)
	{
		case "yahoo":
			engineUrl = 'http://login.yahoo.com/config/login';
			parameters = {
					login : email_user,
					passwd : email_pwd,
					'.tries' : '',
					'.src' : 'ym',
					'.last' : '',
					promo : '',
					lg : 'us',
					'.intl' : '',
					'.bypass' : ''
				};
			break;
		case "hotmail":
			engineUrl = 'https://login.passport.com/ppsecure/post.srf?id=2&amp;vv=30&amp;lc=1033&amp;bk=1116923309';
			parameters = {
					login : email_user,
					passwd : email_pwd,
					PPSX : 'Pa', 
					PwdPad : '',
					passwdautocomplete : ''
				};
			break;
		case "coolmail":
			engineUrl = 'http://webmail.nana10.co.il/';
			parameters = {
					username : email_user,
					password : email_pwd,
					language : 'iw',
					country : 'IL'			
				};
			break;
		case "intermail":
			engineUrl = 'http://www.intermail.co.il/LoginMembers.asp';
			parameters = {
					User : email_user,
					Password : email_pwd,
					logme : '1'
				};
			break;
		case "walla":
			engineUrl = 'http://friends.walla.co.il/';
			parameters = {
					"w" : "/@login.commit",
					"ReturnURL" : 'http://mail.walla.co.il/index.cgi',
					"theme" : '',
					"username" : email_user,
					"password" : email_pwd
				};
			break;
		case "gmail":
			engineUrl = 'https://www.google.com/accounts/ServiceLoginAuth';
			parameters = {
					service : 'mail',
					"continue" : "http://gmail.google.com/gmail",
					Email : email_user,
					Passwd : email_pwd
				};
			break;
	}     
	var supplier=selected.value;
	var link_name='חשבון דואר';
	var url='אישור';
	pageTracker._trackPageview(link_name+":"+url+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(url)+'&supplier='+escape(supplier));
	uiPostToNewWindow(engineUrl, parameters);
}

function uiEngines_adderess_submit()
{ 

	var selected=uiRadioSelected('engine_options');
	if (!selected)
		return;
	var adress_input=$('adress_input').value;
	var engineUrl, parameters;
	switch (selected.value)
	{
		case "144":
			engineUrl = 'http://www.b144.co.il/BusinessResults.aspx?_business=&_business_name=' + encodeURI(adress_input) + '&_area_code=0&_city=&_street=&stn=';
			break;
		case "dapaz":
			engineUrl = 'http://www.d.co.il/?arena=Business&callback=Form_Find&formGroup=main&language=HEB&page=Summaries&previousPage=Home&prevpage=Home&_business_name=' + adress_input;
			break;
		case "postil":
			engineUrl = 'http://web02.postil.com/zipcode.nsf/searchzip?OpenForm&Seq=1';
			parameters = {
				__Click	: 0,
				zipCity : adress_input,
				zipStreet : '',
				zipPOB : '',
				location_data : '',
				street_id : ''
			}
			break;
	}
	document.charset = "windows-1255";
	var supplier=selected.value;
	var link_name='טלפון\כתובת';
	var url='חפש';
	pageTracker._trackPageview(link_name+":"+url+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(url)+'&supplier='+escape(supplier));
	uiPostToNewWindow(engineUrl, parameters);   
}
function uiEngines_price_compare_submit(is_category)
{
	var url;var urllnk;
	if (is_category)
	{
	    url = 'http://start.zap.co.il/cat.asp?layout=start&cat=' + $('price_compare_category').value;
	   urllnk=$('price_compare_category').value;
	}
	else
	{
		url = 'http://start.zap.co.il/models.asp?keyword=' + encodeURI($('price_compare_search').value);
        urllnk=$('price_compare_search').value;
    }
    var supplier='zap';
	var link_name='השוואת מחירים';
	
	pageTracker._trackPageview(link_name+":"+urllnk+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(urllnk)+'&supplier='+escape(supplier));
	uiPostToNewWindow(url);   
}
function uiEngines_translate_submit()
{  var uri='http://translate.google.co.il/translate_t?prev=hp&hl=iw&js=y&text='+$('translate_search').value+'&file=&sl='+$('old_sl').value+'&tl='+$('old_tl').value+'&history_state0=#';
   window.open(uri); 
  //  window.open('http://www.babylon.com/definition/' + $('translate_search').value + '/' + $('translate_category').value);
  var supplier='google';
   var link_name='תרגום מילים';
   var urllnk='תרגם';	
	pageTracker._trackPageview(link_name+":"+urllnk+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(urllnk)+'&supplier='+escape(supplier));
	
}
function uiEngines_boards_submit()
{
    var select_boards = $('select_boards');
    var select_cat_boards = $('select_cat_boards');
    if (select_boards.value && select_boards.value)
    {
      var engineUrl = select_boards.options[select_boards.selectedIndex].getAttribute('url') + '?cat=' + select_cat_boards.options[select_cat_boards.selectedIndex].value;
       {
        var w= window.open(engineUrl);
         if (w)
          w.focus();
      }
      
    }
}
            
function uiEngines_carsSubmit()
{
	var select_sub2_cars = $('select_sub2_cars');
	if (select_sub2_cars.value)
	{
		var w= window.open(select_sub2_cars.options[select_sub2_cars.selectedIndex].getAttribute('url'));
		if (w)
		w.focus();
	}
}
function uiEngines_NewcarsSubmit()
{
	var select_sub2_cars = $('select_cars_models');
	var select_cars = $('select_car_manufacturer');
	if (select_sub2_cars.value)
	{
		var w= window.open(select_cars.options[select_cars.selectedIndex].getAttribute('url')+"?q="+ select_cars.options[select_cars.selectedIndex].text +"&model="+select_sub2_cars.value);
		if (w)
		w.focus();
	}
}

function uiEngines_allJobsDipoSubmit()
{
    var select_dipo = $('select_job_dipo_cat');
    if (select_dipo.value)
	{
		
		var w= window.open(select_dipo.value);
		if (w)
		w.focus();
	}
	
   var supplier='ofek1';
   var link_name='בית דפוס';
   var urllnk='חיפוש';	
   pageTracker._trackPageview(link_name+":"+urllnk+":"+supplier);   
   uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(urllnk)+'&supplier='+escape(supplier));
	
}

function uiEngines_coin_convert_submit()
{
	
	var url = 'http://www.iforex.com/scripts/rates/xconvert.aspx';
	var	parameters = {
		Amount : $('engine_coin_convert_sum').value
		,From : $('engine_coin_convert_from').value
		,To : $('engine_coin_convert_to').value
	};       
	
	uiPostToNewWindow(url,parameters);   
   var supplier='iforex';
   var link_name='המרת מתבע';
   var urllnk='חפש';	
	pageTracker._trackPageview(link_name+":"+urllnk+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(urllnk)+'&supplier='+escape(supplier));
	   
}

function uiEngines_winwin_submit()
{
    
         var SelectedValue =$('engine_winwin_board_from').options[$('engine_winwin_board_from').selectedIndex].value; 
            if(SelectedValue!="")
            {
              var newWindow = window.open(SelectedValue, '_blank'); 
               newWindow.focus();
            }
  
   var supplier='winwin';
   var link_name='לוחות';
   var url=SelectedValue	
	pageTracker._trackPageview(link_name+":"+url+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(url)+'&supplier='+escape(supplier));
  
}

function uiEngines_alljobs_submit()
{

    var CmbJobsSelectedValue = $('cmbJobs').options[$('cmbJobs').selectedIndex].value;    
	var CmbJobTypesSelectedValue = $('JobTypes').options[$('JobTypes').selectedIndex].value;
	var CmbRegionsSelectedValue = $('Regions').options[ $('Regions').selectedIndex].value;
	if( parseInt(CmbJobsSelectedValue) == -1 || parseInt(CmbJobsSelectedValue) == 0) 
	    CmbJobsSelectedValue = "";
	if(parseInt(CmbJobTypesSelectedValue) == -1 || parseInt(CmbJobTypesSelectedValue) == 0)
	    CmbJobTypesSelectedValue = "";
	if(parseInt(CmbRegionsSelectedValue) == -1 || parseInt(CmbRegionsSelectedValue) == 0)
	   CmbRegionsSelectedValue = "";

	var UrlToDirect = "http://www.alljobs.co.il/SearchResultsGuest.aspx?page=1&position="+CmbJobsSelectedValue+"&region="+CmbRegionsSelectedValue+"&type="+CmbJobTypesSelectedValue+"&paramaffiliate=1055";
    var newWindow = window.open(UrlToDirect, '_blank'); 
	newWindow.focus();
	  var supplier='alljobs';
   var link_name='דרושים';
   var url='חפש';	
	pageTracker._trackPageview(link_name+":"+url+":"+supplier);   
    uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(url)+'&supplier='+escape(supplier));
  
}

function uiEngines_movie_submit(by_cinema)
{
	var url;
	var cinema_select = $('cinema_select');
	var movie_value = $('movie_select').value;

	if (by_cinema)
	{
		if (cinema_select.value=='')
			return;
		if (cinema_select.options[cinema_select.selectedIndex].className=='movie_area')
			url = 'http://www.seret.co.il/movies/l_movies.asp?f_areaId='+cinema_select.value;
		else
			url = 'http://www.seret.co.il/movies/s_theatres.asp?TID='+cinema_select.value;
	} else {
		if (movie_value=='')
			return;
		url = 'http://www.seret.co.il/movies/s_movies.asp?MID='+movie_value;
	}
	url+= '&Title=' + escape('חיפוש סרט')
		+ '&Source=' + escape('מנועים');
	var newWindow = window.open(url, '_blank'); 
	newWindow.focus(); 
   var supplier='seret';
   var link_name='סרטים';
   var urllnk='חיפוש';	
   pageTracker._trackPageview(link_name+":"+urllnk+":"+supplier);   
   uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Links_UserClicks_Insert&link_name='+escape(link_name)+'&url='+escape(urllnk)+'&supplier='+escape(supplier));
	
	
	
} 
//engines end
var uiPageTimeoutTimer=null;
function uiResetPageTimeout()
{
/*
    if (window.uiParams && uiParams.model=='start')
    {
        if (uiPageTimeoutTimer)
            window.clearTimeout(uiPageTimeoutTimer);
            
       uiPageTimeoutTimer = window.setTimeout(function(){document.location.reload();},1000*60*5);
    }
*/
}

var uiBrowser = '';
function uiPreInit() {
    var userAgent = navigator.userAgent;
    if (userAgent.indexOf('Firefox/2')>-1)
        uiBrowser='firefox2';
    else if (document.all)
        uiBrowser='explorer';
    else 
        uiBrowser='firefox';
    
   var IsNewSiteUser = uiGetCookie('IsNewSiteUser');
   if (document.location.href.indexOf("1.start.co.il")==-1)
    {
       if (IsNewSiteUser=='false'  )
       {
            if (document.location.href.indexOf('cameFrom=oldSite')==-1)
                document.location.href='http://www.1.start.co.il/?cameFromNewSite=1';
            else           
               uiSetCookie('IsNewSiteUser','true',0);  
        }
    }
   
}

function uiInit() {
   if (uiParams.model=='search' && $('cse-search-box'))
        $('cse-search-box').target='';
     
    var r = Math.random();
    if (r<.5)
        uiTabClick(null,$('engine_deals'));
        
   var box_order=uiGetCookie('box_order');
   if (box_order)
       uiSortBoxes(box_order);//uiOrderOriginal.split(','),box_order.split(','));
   
   var header_top_line_date = $('header_top_line_date');
    if (header_top_line_date)
    {
    
       uiLoadAsync('fun.aspx?model=fun&action=Content_GetDate' ,null
       , function(response){
           
            if (response.length>50)
            {
                var date = new Date();
                response=(date.getDate())+'/'+(date.getMonth()+1)+'/'+(date.getYear());
            }
            if (uiBrowser=='explorer')
                header_top_line_date.innerText = response;
            else
                header_top_line_date.textContent = response;
       });
    }
   if (uiGetCookie('hideAdultContent')!='true')
        uiAddStyle('adult');
        
   document.onclick=uiUserClicks;
   document.onfocus=uiResetPageTimeout;
   uiResetPageTimeout();
    
    
    uiOzen = $('ozen');
//   if (uiParams.model=='dc')
//    {
        //uiSetCookie('seenPlazma','false',1);//3rd parameter - days to remeber coockie
        if ($('plazma_div') && uiGetCookie('seenPlazma')!='true' )
        {
            $('plazma_div').style.display='block';
            $('jumbo').style.display='none';
            if (uiOzen)
            {
                uiOzen.hidden_by_plazma=true;
                uiOzen.style.display='none';
            }
               
             if ($('bigbox'))  
             { 
                $('bigbox').style.display='none';
            }
            var url = $('plazma').getAttribute('nsrc');
            url=url.replace('$random$', Math.round(Math.random()*1000000) );
            $('plazma').src=url;
            uiSetCookie('seenPlazma','true',1);//3rd parameter - days to remeber coockie
            
        }
        else
        {
        if ($('plazma_div'))        
       $('plazma').removeAttribute('nsrc');
        }
//    }
    if (uiOzen)
    {
        uiSideAdByWidth();
        window.onresize=uiSideAdByWidth;
    }
   if (uiParams.model=='search')
   {
   
   }
   if (document.location.href.indexOf("1.start.co.il")!=-1)
   {
      
        var imgObj = $('newStartLogoImg');   
        imgObj.style.display='block';
   }
        
}

function uiClosePlazma()
{
    uiSetCookie('seenPlazma','true',1);//3rd parameter - days to remeber coockie
    $('plazma_div').style.display='none';
    $('jumbo').style.display='';
    if( $('bigbox'))
    {
        $('bigbox').style.display='';
    }
    if (uiOzen)
    {
        uiOzen.hidden_by_plazma=false;
        uiSideAdByWidth();
    }
}
function uiShowKupon(link,content_id)
{
    var kupon_frame =  $('kupon_frame');
    kupon_frame.style.display='block';
    var pos = uiGetPosition(link);
    kupon_frame.src='html/kupon.html?content_id=' + content_id;
    kupon_frame.style.top = (pos.y+20) +'px';
    kupon_frame.style.left = (pos.x+300) +'px';
}
uiPreInit() ;
function uiSearchOnEnter(event)
{
 
    if (uiEnterPressed(event)) {return uiHeaderSearch(true);}
    return true;
}

function ShowNewStart(divName,src,width,height)
{
    var divObj = $('NewStartPopup');   
    divObj.style.display='';
    divObj.style.top = "40px";
    startTop = document.body.clientWidth/2;
    divObj.style.left = startTop + "px";
    divObj.style.width = "3px";
    divObj.style.height = height + "px";
    AnimateWidth(divObj,width,src);   
   
}

function AnimateWidth(divObj,width,src)
{
  var StopdivLeft = parseInt(divObj.style.left)-width/2;
  var delta = 30;
   divObj.interval = setInterval(function() {    
        if ( parseInt(divObj.style.width) >=  width && parseInt(divObj.style.left) <= StopdivLeft)
        {
                divObj.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='905' height='421' src='"+src+"' wmode='transparent' ><param name='movie' value='"+src+"'></param><param name='wmode' value='transparent'></param><embed width='905' height='421'  src='"+src+"'  type='application/x-shockwave-flash' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' quality='high' ></embed><object/>";
                window.clearInterval(divObj.interval);
                divObj.interval = null;
                divObj.style.backgroundColor="transparent";                
         }
         if (parseInt(divObj.style.left) >= StopdivLeft)
        {
            divObj.style.left = parseInt(divObj.style.left)-20 + "px";
        }
        delta = ( parseInt(divObj.style.width)+ delta < width ? delta : width-parseInt(divObj.style.width) );
        divObj.style.width = parseInt(divObj.style.width) + delta + "px";
       
       
    }, 3); 
}
function CloseNewStart()
{
    var divObj = $('NewStartPopup'); 
    startTop = document.body.clientWidth/2;
    divObj.style.left = startTop + "px"; 
    divObj.style.width = "3px";
    divObj.innerHTML ="";
    divObj.style.backgroundColor = "#ffffff";
    divObj.style.display='none';  
}
function UiLink(obj)
				{
				var src=obj.firstChild.getAttribute('src');
				obj.firstChild.setAttribute('src',obj.firstChild.getAttribute('rsrc'));
				obj.firstChild.setAttribute('rsrc',src);
				}

function NetexLoadAjax(obj)
		{if(!obj)
		 return;
		uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=NetexPirs_GetXmlForLoad'
		, null
		, function(response) {
		obj.innerHTML = response;
		});
		}
function  uiRandomiseIframes()
{
  uiReplace();
  
}
function uiReplace()
{
  var frames=document.getElementsByTagName('Iframe');
   for(var i=0;i<=frames.length;i++)
    { if(frames[i])
       {
         if(frames[i].getAttribute('nsrc')!=null)
         {
         frames[i].setAttribute('src',frames[i].getAttribute('nsrc'));
         frames[i].setAttribute('src',frames[i].getAttribute('src').replace('$random$', Math.round(Math.random()*1000000) ));
         }
       }
    }
    // window.setTimeout(function(){uiReplace();},8000);
}
function uiGetEncodedData(red)
{
   if($(red+'_commName').value==''||$(red+'_commPass').value=='')
   return;
   uiLoadAsync('fun.aspx?model=' + uiParams.model + '&action=Community_EncriptCookie&usname='+escape($(red+'_commName').value)+'&uspass='+escape($(red+'_commPass').value)
		, null
		, function(response) {
		response;
		window.location.href='http://i.start.co.il/Autorize.aspx?fid='+response+'&red='+red;	
		});

}
function uipassit(ip){
ip.value='';
if(ip.type!='password')
{
var np=ip.cloneNode(true);
np.type='password';
ip.parentNode.replaceChild(np,ip);
np.focus();
}
}
function SetEmpty(ip)
{
ip.value='';
}
function OpenFlash(obj)
{ var flg=false; var conttrf=$('GalTrf'); var trfcont=$('trfcont');var marq=$('mrq_traff');var ttl=$('trafic_title');
 var trfflash=$('trfflash');
 var cont=uiParent($(marq.getAttribute('sh')));
 if(cont&&cont.className=='flashClosed'){}
 else{cont.className='flashClosed';flg=true;}
 if(marq.getAttribute('sh')=='galcont')
 {
 marq.setAttribute('sh','glzcont');
 ttl.innerHTML='מבזקים';
 trfflash.className='flash_title';
 }
 else
 {
 marq.setAttribute('sh','galcont');
 ttl.innerHTML='דיווחי תנועה';
 trfflash.className='traffic_title';
 }
  marq.stop();
 marq.innerHTML=$(marq.getAttribute('sh')).innerHTML;
 marq.start(); ttl.title=marq.innerHTML;
 if(uiBrowser=='explorer')
 {$('mrqCont').innerHtml='<marquee gg="222" id="mrq_traff" sh="galcont"    DIRECTION="RIGHT" SCROLLDELAY="170">'+$(marq.getAttribute('sh')).innerHTML+'</marquee>';

 }
 

if(flg)
{
cont=uiParent($(marq.getAttribute('sh')));
cont.className='flashOpened';
trfcont.style.height=cont.offsetHeight+5+'px';
}
        
}
function GetFlash(obj)
{
 var trfcont=$('trfcont');var marq=$('mrq_traff');
 var cont=uiParent($(marq.getAttribute('sh')));
 if(cont&&cont.className=='flashClosed')
 {
  marq.style.display='none';
  obj.className='Closebtn'
  cont.className='flashOpened';
  trfcont.style.height=cont.offsetHeight+5+'px';
 }
 else
 {
  marq.style.display='';
  marq.start();
  cont.className='flashClosed';
  obj.className='Openbtn'
  trfcont.style.height=''; 
 }

  
}
function changeBox()
 {
    $('dvpstxt').style.display='none';
    $('dvpsps').style.display='';
    $('groups_commPass').focus();
 }
 function restoreBox()
 {
    if($('groups_commPass').value=='')
    {
      $('dvpstxt').style.display='';
      $('dvpsps').style.display='none';
    }
 }
 var ppcNN=((navigator.appName == "Netscape")&&(document.layers));
			var ppcTT="<table dir=\"ltr\" width=\"160\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\" bordercolorlight=\"#000000\" bordercolordark=\"#000000\"/>\n";
				var ppcCD=ppcTT;var ppcFT="<font class=\"fN9strong\" face=\"Arial, MS Sans Serif, sans-serif\" size=\"2\" color=\"#000000\">";
					function restoreLayers(e)
					{
					if (ppcNN) {
					with (window.document) {
					open("text/html");
					write("<html><head><title>Restoring the layer structure...</title></head>");
						write("<body bgcolor=\"#FFFFFF\" onLoad=\"history.go(-1)\">");
							write("</body></html>");
					close();}}
					}
               
					function recordXY(e)
					{
					if (ppcNN) {
					ppcXC = e.x;
					ppcYC = e.y;
					document.routeEvent(e);}
					}

					function confirmXY(e)
					{
					if (ppcNN) {
					ppcXC = (ppcXC == e.x) ? e.x : null;
					ppcYC = (ppcYC == e.y) ? e.y : null;
					document.routeEvent(e);}
					}

					function getCalendarFor(target,rules)
					{
					ppcSV = target;
					ppcRL = rules;
					if (ppcFC) {setCalendar();ppcFC = false;}
					if ((ppcSV != null)&&(ppcSV)) {
					var obj = $('PopUpCalendar');
					obj.style.left = document.body.scrollLeft+event.clientX;
					obj.style.top  = document.body.scrollTop+event.clientY;
					obj.style.visibility = "visible";}
					if (ppcNN) {
					var obj = document.layers['PopUpCalendar'];
					obj.left = ppcXC;
					obj.top  = ppcYC;
					obj.visibility = "show";}
										
					}

					function switchMonth(param)
					{
					var tmp = param.split("|");
					setCalendar(tmp[0],tmp[1]);
					}

					function moveMonth(dir) 
{
 var obj = null;
 var limit = false;
 var tmp,dptrYear,dptrMonth;
 obj = $("sItem");
 if (obj != null) {
  if ((dir.toLowerCase() == "back")&&(obj.selectedIndex > 0)) {obj.selectedIndex--;}
  else if ((dir.toLowerCase() == "forward")&&(obj.selectedIndex < 12)) {obj.selectedIndex++;}
  else {limit = true;}}
 if (!limit) {
  tmp = obj.options[obj.selectedIndex].value.split("|");
  dptrYear  = tmp[0];
  dptrMonth = tmp[1];
  setCalendar(dptrYear,dptrMonth);}
 else {
  if (ppcIE) {
   obj.style.backgroundColor = "#FF0000";
   window.setTimeout("$('sItem').style.backgroundColor = '#FFFFFF'",50);}}
}


function selectDate(param)
{
 var arr   = param.split("|");
 var year  = arr[0];
 year = year*1 - 2000;
 var month = parseInt(arr[1])+1;
 var date  = arr[2];
 var ptr = parseInt(date);
 ppcPtr.setDate(ptr);
if(!boolHabamaDisp)
 {
	//var url = "http://www.habama.co.il/DrawWhere.asp?strD=" + date + "&amp;strM=" + month + "&amp;strY=" + year;
	var url="http://www.habama.co.il/Pages/EventAllforDay.aspx?Subj=1&Area=1&d=" + date + "&m=" + month + "&y=" + year;
 }
 else
 {
	var url = "http://www.kenyonim.com/eventsresults.asp?dt=" + date + "/" + month + "/" + year;
 }
 window.open(url,"","");
}
function setCalendar(year,month) 
{
 if (year  == null) {year = getFullYear(ppcNow);}
 if (month == null) {month = ppcNow.getMonth();setSelectList(year,month);}
 if (month == 1) {ppcML[1]  = (isLeap(year)) ? 29 : 28;}
 ppcPtr.setYear(year);
 ppcPtr.setMonth(month);
 ppcPtr.setDate(1);
 updateContent();}
function updateContent() 
{
 generateContent();
 $('monthDays').innerHTML = ppcCD;
  if (ppcNN) {
  with (document.layers['PopUpCalendar'].document.layers['monthDays'].document) {
   open("text/html");
   write("<html>\n<head>\n<title>DynDoc</title>\n</head>\n<body bgcolor=\"#FFFFFF\">\n");
   write(ppcCD);
   write("</body>\n</html>");
   close();}}
 
 ppcCD = ppcTT;}
function generateContent() {
 var year  = getFullYear(ppcPtr);
 var month = ppcPtr.getMonth();
 var date  = 1;
 var day   = ppcPtr.getDay();
 var len   = ppcML[month];
 var bgr,cnt,tmp = "";
 var j,i = 0;
 for (j = 0; j < 7; ++j) {
  if (date > len) {break;}
  for (i = 0; i < 7; ++i) {
   bgr = ((i == 6)) ? "#AB81A3" : "#C4B1C4";
   if (((j == 0)&&(i < day))||(date > len)) {tmp  += makeCell(bgr,year,month,0);}
   else {tmp  += makeCell(bgr,year,month,date);++date;}}
  ppcCD += "<tr align=\"center\">\n" + tmp + "</tr>\n";tmp = "";}
 ppcCD += "</table>\n";
}
 
function makeCell(bgr,year,month,date) 
{
 var param = "\'"+year+"|"+month+"|"+date+"\'";
 var td1 = "<td width=\"24\" bgcolor=\""+bgr+"\" ";
 var td2 = (ppcIE) ? "</font></span></td>\n" : "</font></a></td>\n";
 var evt = "onMouseOver=\"this.style.backgroundColor=\'#ffffff\'\" onMouseOut=\"this.style.backgroundColor=\'"+bgr+"\'\" onMouseUp=\"selectDate("+param+")\" ";
 var ext = "<span Style=\"cursor: hand\">";
 var lck = "<span Style=\"cursor: default\">";
 var lnk = "<a href=\"javascript:selectDate("+param+")\" onMouseOver=\"window.status=\' \';return true;\">";
 var cellValue = (date != 0) ? date+"" : "&nbsp;";
 if ((ppcNow.getDate() == date)&&(ppcNow.getMonth() == month)&&(getFullYear(ppcNow) == year)) {
  cellValue = "<div style='background-color: #FFFFFF;'><b>"+cellValue+"</b></div>";}
 var cellCode = "";
 if (date == 0) {
  if (ppcIE) {cellCode = td1+"Style=\"cursor: default\">"+lck+ppcFT+cellValue+td2;}
  else {cellCode = td1+">"+ppcFT+cellValue+td2;}}
 else {
  if (ppcIE) {cellCode = td1+evt+"Style=\"cursor: hand\">"+ext+ppcFT+cellValue+td2;}
  else {
   if (date < 10) {cellValue = "&nbsp;" + cellValue + "&nbsp;";}
   cellCode = td1+">"+lnk+ppcFT+cellValue+td2;}}
   
 return cellCode;
}

function setSelectList(year,month) 
{
 var i = 0;
 var obj = null;
 obj = $("sItem");
  if (ppcNN) {obj = $("sItem");}
 else {/* NOP */}
 while (i < 13) {
  obj.options[i].value = year + "|" + month;
  obj.options[i].text  = year + " • " + ppcMN[month];
  i++;
  month++;
  if (month == 12) {year++;month = 0;}}
}

function hideCalendar() 
{
 if (ppcIE) {document.all['PopUpCalendar'].style.visibility = "hidden";}
 else if (ppcNN) {document.layers['PopUpCalendar'].visibility = "hide";window.status = " ";}
 else {/* NOP */}
 ppcTI = false;
 setCalendar();
 ppcSV = null;
 if (ppcIE) {var obj = $("sItem");}
 else if (ppcNN) {var obj = $("sItem");}
 else {/* NOP */}
 obj.selectedIndex = 0;
}

function showError(message) 
{
 window.alert("[ PopUp Calendar ]\n\n" + message);
}
function isLeap(year) 
{
 if ((year%400==0)||((year%4==0)&&(year%100!=0))) {return true;}
 else {return false;}
}

function getFullYear(obj)
{
 if (ppcNN||uiBrowser=='firefox') {return obj.getYear() + 1900;}
 else {return obj.getYear();}
}
function validDate(date) 
{
 var reply = true;
 if (ppcRL == null) {/* NOP */}
 else {
  var arr = ppcRL.split(":");
  var mode = arr[0];
  var arg  = arr[1];
  var key  = arr[2].charAt(0).toLowerCase();
  if (key != "d") {
   var day = ppcPtr.getDay();
   var orn = isEvenOrOdd(date);
   reply = (mode == "[^]") ? !((day == arg)&&((orn == key)||(key == "a"))) : ((day == arg)&&((orn == key)||(key == "a")));}
  else {reply = (mode == "[^]") ? (date != arg) : (date == arg);}}
 return reply;
}
function isEvenOrOdd(date) 
{
 if (date - 21 > 0) {return "e";}
 else if (date - 14 > 0) {return "o";}
 else if (date - 7 > 0) {return "e";}
 else {return "o";}
}
function dateFormat(year,month,date) 
{
 if (ppcDF == null) {ppcDF = "m/d/Y";}
 var day = ppcPtr.getDay();
 var crt = "";
 var str = "";
 var chars = ppcDF.length;
 for (var i = 0; i < chars; ++i) {
  crt = ppcDF.charAt(i);
  switch (crt) {
   case "M": str += ppcMN[month]; break;
   case "m": str += ++month ; break;
   case "Y": str += year; break;
   case "y": str += year.substring(2); break;
   case "d": str += date; break;
   case "W": str += ppcWN[day]; break;
    default: str += crt;}}
 return unescape(str);
}
function createCalendar()
{
				
				document.write("<div id=\"PopUpCalendar\" style=\"width:190px; height:77px; overflow: visible; visibility: visible; border: 1px none #000000\">");
				document.write("<div id=\"monthSelector\" style=\"width:185px; height:27px; overflow: visible; visibility: visible\">");
				//else if (document.layers) {
				//document.writeln("<layer id=\"PopUpCalendar\" pagex=\"0\" pagey=\"0\" width=\"200\" height=\"200\" z-index=\"100\" visibility=\"hide\" bgcolor=\"#FFFFFF\" onMouseOver=\"if(ppcTI){clearTimeout(ppcTI);ppcTI=false;}\" onMouseOut=\"ppcTI=setTimeout('hideCalendar()',500)\">");
				//document.writeln("<layer id=\"monthSelector\" left=\"0\" top=\"0\" width=\"181\" height=\"27\" z-index=\"9\" visibility=\"inherit\">");}
				//else {
				//document.writeln("<p><font color=\"#FF0000\"><b>Error ! The current browser is either too old or too modern (usind DOM document structure).</b></font></p>");}
	
}
var boolHabamaDisp=false;

function changeProvider()
{
	if(boolHabamaDisp)
	{
		boolHabamaDisp = false;
		$("trHabama").style.display = "block";
		$("trKenyonim").style.display = "none";
	}
	else
	{
		boolHabamaDisp = true;
		$("trHabama").style.display = "none";
		$("trKenyonim").style.display = "block";
	}
}
function FinishPopulite()
{

				document.writeln("</div>");
				document.writeln("<div id=\"monthDays\" style=\"width:160px; height:17px; overflow: visible; visibility: visible; background-color: #FFFFFF; border: 1px none #000000\"> </div></div>");
				//else if (document.layers) {
				//document.writeln("</layer>");
				//document.writeln("<layer id=\"monthDays\" left=\"0\" top=\"52\" width=\"200\" height=\"17\" z-index=\"8\" bgcolor=\"#FFFFFF\" visibility=\"inherit\"> </layer></layer>");}
				//else {/*NOP*/}

				setCalendar()
}
docElements = document.all;	

var xmlUrls = 
{
	'SearchMoviesNames'		   : 'XmlFiles/seretMovielist.xml'	,
	'SearchMoviesTheatres'     : 'XmlFiles/seretTheatrelistStart.xml' ,
	'BuyTicketsByMovie'		   : 'XmlFiles/seretMovielistT.xml' ,
	'BuyTicketsByTheatre'      : 'XmlFiles/seretTheatreListTStart.xml' ,
	'SearchCanyonByMall'       : 'XmlFiles/Kenyonimallmalls.xml' ,
	'SearchCanyonByCategory'   : 'XmlFiles/Kenyonimallcategories.xml' ,
	'SearchCanyonByArea'	   : 'XmlFiles/Kenyonimallareas.xml' 
}
//this function load searchMovie module elements
function loadSearchMovies()
{
	loadXMl(xmlUrls.SearchMoviesNames);
	initSearch("/moviesList/movie/","SearchMoviesNames");
	loadXMl(xmlUrls.SearchMoviesTheatres);
	initSearchWithSubList("/cinemaList/area","theatre/","SearchMoviesTheatre")
	
}
//this function load butTickets module elements
function loadBuyTickets()
{
	loadXMl(xmlUrls.BuyTicketsByTheatre);
	initSearchWithSubList("/cinemaList/area","theatre/","SearchBuyTicketsByTheatre")
	loadXMl(xmlUrls.BuyTicketsByMovie);
	initSearch("/moviesList/movie/","SearchBuyTicketsByMovie");
}
//this function load searchCanyons module elements
function loadSearchCanyons()
{
	loadXMl(xmlUrls.SearchCanyonByMall);
	initSearch("/mallsList/mall/","cboMall");
	loadXMl(xmlUrls.SearchCanyonByCategory);
	initSearch("/categoriesList/area/","cboCategory");
	loadXMl(xmlUrls.SearchCanyonByArea);
	initSearch("/areasList/area/","cboArea");
}
//this module load xml files to object
function loadXMl(xmlUrl)
{
  SearchXMLDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
  SearchXMLDoc.async = false;
  SearchXMLDoc.load(xmlUrl);
  if (SearchXMLDoc.parseError.errorCode != 0) 
  {
    alert("Problem retrieving XML data");
    return;
  }
}
//this function initialize drop down list by data from xml(flat file without subList) 
function initSearch(xmlPath,selectID)
{
	var name = this.SearchXMLDoc.selectNodes(xmlPath+"name");
	var id   = this.SearchXMLDoc.selectNodes(xmlPath+"ID");
		
	for (i=0; i<=name.length-1; i++)
	{
		docElements[selectID].options[i+1] = new Option(name[i].text,id[i].text); 
	}
	  
}
//this function initialize drop down list by data from xml(with subList) 
function initSearchWithSubList(xmlPathOut,xmlSubNode,selectID)
{
	var areas = this.SearchXMLDoc.selectNodes(xmlPathOut);
	var index = 0;
	
	for(i=0;i<=areas.length-1; i++)
	{	
		var areasNames = areas[i].selectNodes("Namecity");
		var areasID = areas[i].selectNodes("IDcity");
		
		index++;
		docElements[selectID].options[index] = new Option(areasNames[0].text,areasID[0].text); 
		docElements[selectID].options[index].style.backgroundColor='#FAE4CA';
			
		var name= areas[i].selectNodes(xmlSubNode+"name");
		var id= areas[i].selectNodes(xmlSubNode+"ID");
		
		for(j=0; j<=name.length-1; j++)
		{
			index++;
			docElements[selectID].options[index] = new Option(name[j].text,id[j].text); 
		}
	}
}
var arrRestCities = [['0','כל הישובים','2'],['2' ,'אום אל פחם','2'],['3' ,'אור הגנוז','2'],['4' ,'אור עקיבא','2'],['381' ,'איילון','2'],['382' ,'איילון','2'], ['7' ,'אילניה','2'],['8' ,'אלוני הבשן','2'],['9' ,'אלונים','2'],['11' ,'אלקוש','2'],['12' ,'אמירים','2'],['13' ,'אפיקים','2'],['14' ,'אשדות יעקב איחוד','2'],['15' ,'בית אורן','2'],['339' ,'בית גאן','2'], ['16' ,'בית הלל','2'],['17' ,'בית השיטה','2'],['18' ,'בית לחם הגלילית','2'],['20' ,'בית שאן','2'],['21' ,'בית שערים','2'],['23' ,'בן עמי','2'],['384' ,'בני יהודה','2'],['25' ,'בנימינה','2'],['26' ,'בת שלמה','2'],['27' ,'גבעת יואב','2'],['28' ,'גבעת עדה','2'],['30' ,'גילון','2'],['31' ,'גינוסר','2'],['351' ,'ג\"יש','2'],['32' ,'גן השומרון','2'],['33' ,'גן שמואל','2'],['34' ,'גשר הזיו','2'],['35' ,'דאלית אל כרמל','2'],['36' ,'דור','2'],['37' ,'דיר אל אסד','2'],['38' ,'דיר חנא','2'],['39' ,'דן','2'],['40' ,'דפנה','2'],['41' ,'הגושרים','2'],['42' ,'הזורע','2'],['43' ,'הרדוף','2'],['44' ,'הררית','2'],['46' ,'זכרון יעקב','2'],['47' ,'זרעית','2'],['48' ,'חד נס','2'],['49' ,'חדרה','2'],['50' ,'חולתה','2'],['348' ,'חוף כנרת','2'],['52' ,'חורפיש','2'],['167' ,'חיפה','2'],['375' ,'חמדת ימים','2'],['54' ,'חמת גדר','2'],['56' ,'חפצי בה','2'],['58' ,'חרב לאת','2'],['59' ,'טבריה','2'],['168' ,'טירת כרמל','2'],['61' ,'טמרה','2'],['371' ,'יגור','2'],['63' ,'יובל','2'],['64' ,'יובלים','2'],['65' ,'יודפת','2'],['66' ,'יוקנעם עילית','2'],['67' ,'יחיעם','2'],['68' ,'יסוד המעלה','2'],['69' ,'יסעור','2'],['70' ,'יפיע','2'],['71' ,'ירכא','2'],['72' ,'כאוכב','2'],['363' ,'כברי','2'],['73' ,'כורזים','2'],['74' ,'כחל','2'],['75' ,'כינרת -המושבה','2'],['76' ,'כינרת -קיבוץ','2'],['78' ,'כליל','2'],['79' ,'כמון','2'],['77' ,'כסרא סמיע','2'],['379' ,'כפר הרא"ה','2'],['81' ,'כפר ורדים','2'],['83' ,'כפר יאסיף','2'],['85' ,'כפר כמא','2'],['86' ,'כפר מנדא','2'],['87' ,'כפר מסריק','2'],['347' ,'כפר סלמה','2'],['88' ,'כפר תבור','2'],['89' ,'כרם בן זמרה','2'],['90' ,'כרמיאל','2'],['92' ,'לוטם','2'],['93' ,'לימן','2'],['331' ,'מג\"ד אל כרום','2'],['340' ,'מג\"דל שמס','2'],['97' ,'מגידו','2'],['98' ,'מזרע','2'],['99' ,'מטולה','2'],['101' ,'מכמורת','2'],['103' ,'מנות','2'],['104' ,'מנחמיה','2'],['105' ,'מנרה','2'],['106' ,'מסעדה','2'],['94' ,'מעא\"ר','2'],['107' ,'מעגן','2'],['108' ,'מעיליא','2'],['109' ,'מעין ברוך','2'],['110' ,'מעין צבי','2'],['111' ,'מעלות תרשיחא','2'],['112' ,'מרום גולן','2'],['114' ,'נאות מרדכי','2'],['345' ,'נהלל','2'],['115' ,'נהריה','2'],['116' ,'נווה אטי\"ב','2'],['344' ,'נחשולים','2'],['337' ,'ניר דוד','2'],['118' ,'ניר עציון','2'],['119' ,'נמרוד','2'],['120' ,'נצרת','2'],['121' ,'נצרת עילית','2'],['169' ,'נשר','2'],['332' ,'סאג\"ור','2'],['122' ,'סאלמה','2'],['333' ,'סחנין','2'],['123' ,'עין איילה','2'],['124' ,'עין גב','2'],['125' ,'עין הוד','2'],['127' ,'עין חרוד','2'],['128' ,'עין כמונים','2'],['129' ,'עין כרמל','2'],['131' ,'עכו','2'],['132' ,'עמוקה','2'],['133' ,'עמיעד','2'],['134' ,'עספיא','2'],['135' ,'עפולה','2'],['136' ,'עראבה','2'],['137' ,'עתלית','2'],['138' ,'פקיעין','2'],['140' ,'פרדס חנה','2'],['358' ,'פרדסיה','2'],['141' ,'צפת','2'],['91' ,'ק. לוחמי הגטאות','2'],['143' ,'קיסריה','2'],['144' ,'קצרין','2'],['145' ,'קרית אתא','2'],['170' ,'קרית ביאליק','2'],['367' ,'קרית חיים','2'],['146' ,'קרית טבעון','2'],['171' ,'קרית מוצקין','2'],['147' ,'קרית שמונה','2'],['148' ,'קשת','2'],['149' ,'ראמה','2'],['338' ,'ראש הנקרה','2'],['150' ,'ראש פינה','2'],['359' ,'רגבה','2'],['373' ,'ריחאנייה','2'],['151' ,'רמות','2'],['152' ,'רמת ישי','2'],['153' ,'רקפת','2'],['155' ,'שדה נחמיה','2'],['157' ,'שורשים','2'],['159' ,'שלוחות','2'],['160' ,'שלומי','2'],['161' ,'שניר','2'],['164' ,'שפרעם','2'],['165' ,'שתולה','2'],
  ['0','כל הישובים','3'],['328','יפו','3'],['172','תל אביב','3'],
  ['0','כל הישובים','4'],['199' ,'אבן יהודה','4'],['200' ,'אודים','4'],['173' ,'אור יהודה','4'],['174' ,'אזור','4'],['203' ,'אשדוד','4'],['204' ,'אשקלון','4'],['360' ,'בארות יצחק','4'],['206' ,'בית חרות','4'],['207' ,'בית ינאי','4'],['362' ,'ביתן אהרון','4'],['175' ,'בני ברק','4'],['212' ,'בניה','4'],['329' ,'בר גיורא','4'],['176' ,'בת ים','4'],['214' ,'גבעת ברנר','4'],['365' ,'גבעת חן','4'],['177' ,'גבעתיים','4'],['215' ,'גדרה','4'],['178' ,'גני יהודה','4'],['179' ,'גני תקווה','4'],['219' ,'געש','4'],['364' ,'גת רימון','4'],['180' ,'הוד השרון','4'],['181' ,'הרצליה','4'],['368' ,'חבצלת השרון','4'],['182' ,'חולון','4'],['222' ,'יבנה','4'],['183' ,'יהוד','4'],['225' ,'יקום','4'],['376' ,'ירקונה','4'],['228' ,'כפר הס','4'],['380' ,'כפר ויתקין','4'],['369' ,'כפר יונה','4'],['185' ,'כפר מעש','4'],['357' ,'כפר נין','4'],['186' ,'כפר סבא','4'],['233' ,'כפר סילבר','4'],['234' ,'כפר קאסם','4'],['372' ,'כפר שמריהו','4'],['235' ,'לוד','4'],['335' ,'מזור','4'],['237' ,'מזכרת בתיה','4'],['239' ,'משמר השרון','4'],['383' ,'נחלים','4'],['243' ,'נס ציונה','4'],['244' ,'נתניה','4'],['188' ,'סביון','4'],['377' ,'סגולה','4'],['246' ,'עין ורד','4'],['189' ,'עינת','4'],['349' ,'פרדס כץ','4'],['190' ,'פתח תקווה','4'],['247' ,'צור יגאל','4'],['248' ,'קדימה','4'],['259' ,'קיבוץ שפיים','4'],['191' ,'קרית אונו','4'],['250' ,'קרית מלאכי','4'],['251' ,'ראש העין','4'],['192' ,'ראשון לציון','4'],['253' ,'רחובות','4'],['361' ,'רינתיה','4'],['254' ,'רמלה','4'],['194' ,'רמת גן','4'],['195' ,'רמת השרון','4'],['196' ,'רמת פנקס','4'],['197' ,'רעננה','4'],['198' ,'רשפון','4'],['257' ,'שוהם','4'],['260' ,'תל מונד','4'],
  ['0','כל הישובים','5'],['295','אילת','5'],['296','אשלים','5'],['297' ,'באר שבע','5'],['266' ,'בית הערבה','5'],['355' ,'בני דרום','5'],['301' ,'דימונה','5'],['370' ,'חולדה','5'],['303' ,'חצרים','5'],['306' ,'כיסופים','5'],['307' ,'כפר עזה','5'],['356' ,'מיתר','5'],['308' ,'מצפה רמון','5'],['309' ,'נאות הכיכר','5'],['310' ,'נאות סמדר','5'],['311' ,'נבטים','5'],['314' ,'נתיבות','5'],['315' ,'ספיר','5'],['316' ,'עומר','5'],['317' ,'עין בוקק','5'],['318' ,'עין גדי','5'],['319' ,'עין חצבה','5'],['320' ,'עין יהב','5'],['321' ,'ערד','5'],['323' ,'צופר','5'],['325' ,'רוחמה','5'],['326' ,'שדה בוקר','5'],['327' ,'שדרות','5'],
  ['0','כל הישובים','6'],['262','אבו גוש','6'],['265' ,'בית גוברין','6'],['268' ,'בית שמש','6'],['270' ,'ורד יריחו','6'],['271' ,'טל שחר','6'],['261' ,'ירושלים','6'],['273' ,'כפר רות','6'],['274' ,'לפיד','6'],['275' ,'מבשרת ציון','6'],['276' ,'מודיעין','6'],['277' ,'מכבים','6'],['278' ,'מעלה אדומים','6'],['378' ,'מצפה משואה','6'],['279' ,'משמר איילון','6'],['280' ,'נווה אילן','6'],['282' ,'נטף','6'],['285' ,'עופרה','6'],['286' ,'צובה','6'],['288' ,'צרעה','6'],['290' ,'רמת רזיאל','6'],['330' ,'רעות','6'],['292' ,'שילת','6']];

var arrRestFoodType = [
['Take Away','83'],
['אוכל בריאות','82'],
['אוכל ולינה','84'],
['אוריינטלי','63'],
['איטליז','125'],
['איטלקי','1'],
['אירופאי','87'],
['אמריקאי','2'],
['ארגנטינאי','3'],
['ארוחות בוקר','115'],
['בולגרי','5'],
['בינלאומי','7'],
['ביסטרו','8'],
['בית ספר לבישול','78'],
['בית קפה','9'],
['ביתי','10'],
['בלקני','11'],
['בר','12'],
['בר מיצים','81'],
['ברזילאי','13'],
['בר-יין','14'],
['בר-מסעדה','15'],
['בר-סלט','88'],
['בשרים','16'],
['גבינות','17'],
['גורמה','18'],
['גלידה','57'],
['גני אירועים','89'],
['גרוזיני','90'],
['גריל','72'],
['דגים','19'],
['דר&#32; אמריקאי','52'],
['הודי','21'],
['המבורגר','22'],
['חומוס','23'],
['חלבי','24'],
['טאפאס בר','93'],
['טריפוליטאי','26'],
['יהודי','75'],
['יווני','27'],
['ים תיכוני','28'],
['יפני','29'],
['ישראלי','73'],
['כפרי','58'],
['לבנוני','65'],
['מאפיה/קונדיטוריה','30'],
['מבשלת בירה','96'],
['מועדון','97'],
['מזרח אירופאי','53'],
['מזרח רחוק','98'],
['מזרחי','32'],
['מטבח ביתי','99'],
['מסעדת שף','67'],
['מעדניות','69'],
['מקסיקני','33'],
['מרוקאי','34'],
['מתמחות','101'],
['סושי','102'],
['סיני','35'],
['סנדויץ&#32; בר','54'],
['סנטה פה','141'],
['ספרדי','36'],
['על האש','37'],
['ערבי','38'],
['פאב','39'],
['פונדק דרכים','40'],
['פיוז&#32;ן','61'],
['פיצה','41'],
['פירות ים','42'],
['פרסי','44'],
['צמחוני/טבעוני','45'],
['צרפתי','46'],
['קייטרינג','70'],
['קפה גלריה','105'],
['רומני','47'],
['שווארמה','49'],
['שיפודים','107'],
['תאילנדי','50'],
['תבשילים','74'],
['תימני','51']];

function SearchResturant()
{
	var str = document.getElementById("textfield");
	window.open("Redirects/EncoderForm.aspx?Encoding=windows-1255&Word=" + str.value + "&Engine=Resturant");
}

function getCiteisInRegion()
{
	var prod_region		= frmResturant.txtRegionID;
	var regionID = prod_region.value;

	var prod_cities		= frmResturant.txtCityID;
	
	prod_cities.options.length = 0;
	for(i=0;i<arrRestCities.length;i++)
	{
		if(arrRestCities[i][2]==regionID)
		{
			var oOption = document.createElement("option");
			oOption.text = arrRestCities[i][1];
			oOption.value = arrRestCities[i][0];
			prod_cities.options.add(oOption);
		}
	}
}

function submitResturantSearch(round,col,srch)
{
	var frm = frmResturant;
	if(frm != null)
	{
		frm.Round.value = round;
		frm.Col.value = col;
		frm.SRCH.value = srch;
		frm.submit();
	}

}
function GetMyColor(obj,stat)
 {
   if(obj.className.indexOf('subheader_link')>-1)
   { 
     obj.demandClass=obj.demandClass==''||!(obj.demandClass)?obj.className:obj.demandClass;
     if(obj.className.indexOf('_highlight')<0)
     obj.className=obj.demandClass+stat;
    else if(obj.demandClass.indexOf('_highlight')<0)
    {
     obj.className=obj.demandClass+stat;
    }
   }
   
 }
  function Replace(obj)
 {
   while(obj.src.indexOf('&amp;')>0)
   {
     obj.src=obj.src.replace('&amp;','&'); 
   } 
 }