﻿
var defTab;
var curTab;
var it;
var flag = true;

function initPage()
{
    $('#theMenu').mouseout(function() {
      it = setInterval("setCurPage()",3000);
      
    });

    $('#theMenu').mouseover(function() {
      clearInterval(it);
    });
}

function setDefault(obj)
{
    defTab = obj;
    menuShow(defTab);
}

function setCurPage()
{
    menuHide(curTab);
    
    if (defTab != undefined)
        menuShow(defTab);
}


function menuShow(obj)
{
    if (flag)
    {
        initPage();
        flag = false;
    }
    
     if (curTab != obj)
        menuHide(curTab);
        
    document.getElementById(obj).style.backgroundImage = 'url(images/clipart/menuOver.png)';
    
    
    var miObj = document.getElementById(obj + "Item");
    
    if (miObj != undefined)
        miObj.style.display = '';
        //$(miObj).slideDown("slow");

    curTab = obj;
}


function menuHide(obj)
{
    if (obj != undefined)
    {
        document.getElementById(obj).style.backgroundImage = 'url(images/clipart/menuOut.png)';
        
        var miObj = document.getElementById(obj + "Item");
        
        if (miObj != undefined)
            miObj.style.display = 'none';
            //$(miObj).slideUp("fast");
    }
}







function del()
{
    var answer= confirm("אתה בטוח שברצונך למחוק");
    if (answer== true)
     {
        return true;
     }
    else
     {
        return false;
     }
}

function chooseDate(objName,CalPath)
{
	document.form1.hiddenDateOpener.value = objName;
	var new_window=window.open(CalPath,null, "height=270,width=270,status=no,toolbar=no,menubar=no,location=no");
}

function openpopup(url)
{
    window.open(url);
}

function PopUpPic(url)
{
    window.open(url,'mifalot', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=750,height=600,left = 280,top = 150');
    
}

    


function ieupdate()
{
	var strBrowser = navigator.userAgent.toLowerCase(); 
	if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0)
	{  
		var theObjects = document.getElementsByTagName('object');  
		var theObjectsLen = theObjects.length;  
		for (var i = 0; i < theObjectsLen; i++) 
		{   
			if(theObjects[i].outerHTML)
			{    
				if(theObjects[i].data)
				{
					theObjects[i].removeAttribute('data');
				}
				var theParams = theObjects[i].getElementsByTagName("param");    
				var theParamsLength = theParams.length;    
				for (var j = 0; j < theParamsLength; j++) 
				{
					if(theParams[j].name.toLowerCase() == 'flashvars')
					{
							var theFlashVars = theParams[j].value;      
					}    
				}    
				var theOuterHTML = theObjects[i].outerHTML;    
				var re = /<param name="FlashVars" value="">/ig;    
				theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");    
				theObjects[i].outerHTML = theOuterHTML;   
			}  
		} 
		
		var theObjects = document.getElementsByTagName('embed');  
		var theObjectsLen = theObjects.length;  
		for (var i = 0; i < theObjectsLen; i++) 
		{   
			if(theObjects[i].outerHTML)
			{    
				if(theObjects[i].data)
				{
					theObjects[i].removeAttribute('data');
				}
				var theParams = theObjects[i].getElementsByTagName("param");    
				var theParamsLength = theParams.length;    
				for (var j = 0; j < theParamsLength; j++) 
				{
					if(theParams[j].name.toLowerCase() == 'flashvars')
					{
							var theFlashVars = theParams[j].value;      
					}    
				}    
				var theOuterHTML = theObjects[i].outerHTML;    
				var re = /<param name="FlashVars" value="">/ig;    
				theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");    
				theObjects[i].outerHTML = theOuterHTML;   
			}  
		} 
		
	}
}
window.onunload = function() 
{ 
	if (document.getElementsByTagName) 
	{  
		var objs = document.getElementsByTagName("object");  
		for (i=0; i<objs.length; i++) 
		{
		objs[i].outerHTML = "";  
		}
	}
}


