
function validateForm()
{

	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var email = document.getElementById("mm_newemail").value;
	
	if ( email.length > 0 && filter.test(email) ) 
	{
		return true;
	}
	else
	{
		document.getElementById("err").innerHTML = "<br><br><a style='color:#A42426'>The email address you have entered is not valid.</a>";
		document.getElementById("err").style.display = "block";
		return false;
	}
}



// ********************** MARQEE LOGOS  ***********************************************************
var flag=0 ;
var arrImages = new Array() ;
var arrImagesCounter = 1 ;

if (direction == "ltr")
{
    arrImages[0] = "<img src=\"/images/logos/Lufthansa.gif\" class=\"imgLogos\"/><img src=\"/images/logos/Continental.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Swiss.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Avis.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Ofran.gif\" class=\"imgLogos\"/>" ;  
    arrImages[1] = "<img src=\"/images/logos/Ikea.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Loreal.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Lancome.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Timeout.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/cal.gif\" class=\"imgLogos\"/>" ;  
    arrImages[2] = "<img src=\"/images/logos/Kasamba.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Incredimail.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Babylon.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/IBM.gif\" class=\"imgLogos\"/> <img src=\"/images/logos/Lenovo.gif\" class=\"imgLogos\"/>" ;          
}
else
{
    arrImages[0] = "<img src=\"../images/logos/ynet.gif\" class=\"imgLogos\"/><img src=\"../images/logos/haaretz.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/themarker.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/achbar_hair.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/timeout.gif\" class=\"imgLogos\"/>" ;  
    arrImages[1] = "<img src=\"../images/logos/Babylon.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/Incredimail.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/IBM.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/Lenovo.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/Kasamba.gif\" class=\"imgLogos\"/>" ;  
    arrImages[2] = "<img src=\"../images/logos/prizma.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/clal.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/tamir_fishman.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/leumi_card.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/cal.gif\" class=\"imgLogos\"/>" ;   
    arrImages[3] = "<img src=\"../images/logos/issta.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/daka90.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/travelist.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/ofir.gif\" class=\"imgLogos\"/> <img src=\"../images/logos/ofran.gif\" class=\"imgLogos\"/>" ; 
}

function stopTimer()
{
    ChangePicsMarquee() ;
    window.setTimeout("StopWait()" , 2500 );
}

function startTimer()
{
    window.setTimeout(function() {
        document.getElementById("mrq").start();
    } ,2000 )  
}

function changePics() 
{
 
    ChangePicsMarquee() ;
}

function StopWait() 
{
    document.getElementById("mrq").stop();
 
    startTimer() ;
}

function ScrollFade() 
{

    if (parseInt(document.getElementById("mrq").stopAt / 2) == parseInt(document.getElementById("mrq").newPosition))
    {
          flag=1;
          StopWait() ;   
    }
    else if (parseInt(document.getElementById("mrq").stopAt) == parseInt(document.getElementById("mrq").newPosition)) 
    {
        ChangePicsMarquee() ;
        flag=0;
    }
    
    if (flag==1 && (document.getElementById("mrq").stopAt-document.getElementById("mrq").newPosition < 100 && document.getElementById("mrq").stopAt-document.getElementById("mrq").newPosition > 10))
       {
       }// document.getElementById("LogosContainer").style.opacity = "." + ((document.getElementById("mrq").stopAt-document.getElementById("mrq").newPosition)*9) ;
    else if (document.getElementById("mrq").stopAt-document.getElementById("mrq").newPosition < 10) 
      {
      
      }//  document.getElementById("LogosContainer").style.opacity = ".01" ;
    else
    {
        
        document.getElementById("LogosContainer").style.opacity = ".99" ;
    }
    window.setTimeout("ScrollFade()",60 )  
}

function ChangePicsMarquee() 
{
    

    if (document.getElementById("LogosContainer").innerHTML == "") 
    {
        document.getElementById("LogosContainer").innerHTML  = arrImages[0]  ; 
    }
    else
    {
        if (arrImagesCounter > arrImages.length-1)
            arrImagesCounter = 0 ;
            
         
    }
    document.getElementById("LogosContainer").innerHTML  = arrImages[arrImagesCounter] ; 
    arrImagesCounter++ ; 
}


// ***********************************************************************************************

// left pos for absolute div
function getAbsoluteLeft(objectId) {
	o = objectId
	oLeft = o.offsetLeft           
	while(o.offsetParent!=null) {   
		oParent = o.offsetParent    
		oLeft += oParent.offsetLeft 
		o = oParent
	}
	return oLeft
}
// top pos for absolute div
function getAbsoluteTop(objectId) {
	o = objectId
	oTop = o.offsetTop           
	while(o.offsetParent!=null) { 
		oParent = o.offsetParent  
		oTop += oParent.offsetTop 
		o = oParent
	}
	return oTop
}
var leftToMove = 0 ;

function cngLeftMove(val,num)
{
    leftToMove = num ;
    return val;
}

// set left pos to div
function displayMenu(val)
{
    var MENU_MIN_WIDTH = 120; 
    leftToMove=120;
    
    if (navigator.appVersion.indexOf("MSIE 6") > -1)
        topToMove = 23 ;
    else
        topToMove = 21 ; 

    if (direction != "rtl")
    {
        var leftA = getAbsoluteLeft(val) ;
        $(val).children("ul.Category").css("position", "absolute").css("display", "block").css("left", (leftA - 18) + "px").css("top", (getAbsoluteTop($(val)[0]) + topToMove) + "px").show("slow");
        var item = $(val).find("ul.Category li a.hide").css("display", "block").css("background-image", "url(/images/menu_ltr.gif)").css("padding-bottom","5px").css("color","Black").css("font-size","10px").css("text-align","left").css("padding-top","2px").css("padding-left","4px").css("border-left","solid 2px white").css("border-right","solid 2px white").css("border-bottom","solid 2px white").css("z-index","100").width("95%").css("white-space", "nowrap");
        
        var maxWidth = 0 ;
        
        if ($(item[0]).parents("UL")[0])
        {
            if ($(item[0]).parents("UL")[0].style.width == "")
            {
                $(item[0]).parents("UL")[0].style.width = "auto";
                
                var ulChilds = $($(item[0]).parents("UL")[0]).children("LI");
                
                for(i=0;i<ulChilds.length;i++)
                {
                    if (maxWidth < item[i].clientWidth)
                        maxWidth = item[i].clientWidth;
                }
                
                if (maxWidth < MENU_MIN_WIDTH)
                    maxWidth = MENU_MIN_WIDTH ;
                
                $(ulChilds).css("width", (maxWidth + 5) + "px");
                $(item).css("width", (maxWidth + 5) + "px");
                
                displayMenu(val)
           }  
       }
        
    }
    else
    {
        var leftA = getAbsoluteLeft($(val).next().length > 0 ? ($(val).next()[0].className == "ToolBarSpec" ? $(val).next()[0] : val) : cngLeftMove(val, 90) ) ;
        if ($(val).next().length == 0)
        {
            leftToMove = leftToMove - val.clientWidth + 48 ;
        }
        
        $(val).children("ul.Category").css("position", "absolute").css("display", "block").css("left", (leftA - leftToMove + 8) + "px").css("top", (getAbsoluteTop($(val)[0]) + 21) + "px").show("slow");
        var item = $(val).find("ul.Category li a.hide").css("display", "block").css("background-image", "url(/images/menu_ltr.gif)").css("padding-bottom","5px").css("color","Black").css("font-size","11px").css("text-align","right").css("padding-top","2px").css("padding-right","4px").css("border-left","solid 2px white").css("border-right","solid 2px white").css("border-bottom","solid 2px white").css("z-index","100").width("95%").css("white-space", "nowrap");
        
        var maxWidth = 0 ;
        
        if ($(item[0]).parents("UL")[0])
        {
            if ($(item[0]).parents("UL")[0].style.width == "")
            {
                $(item[0]).parents("UL")[0].style.width = "auto";
                
                var ulChilds = $($(item[0]).parents("UL")[0]).children("LI");
                
                for(i=0;i<ulChilds.length;i++)
                {
                    if (maxWidth < item[i].clientWidth)
                        maxWidth = item[i].clientWidth;
                }
                
                if (maxWidth < MENU_MIN_WIDTH)
                    maxWidth = MENU_MIN_WIDTH ;
                
                $(ulChilds).css("width", (maxWidth + 5) + "px");
                $(item).css("width", (maxWidth + 5) + "px");
                
                displayMenu(val)
           }  
       }
    }
       

  //sub Categories 

//  if ($(val).children("ul.subCategory").length > 0)
//    $(val).find("ul.subCategory").css("position", "absolute").css("display", "block").css("left", (+139) + "px").css("top", (+44) + "px").css("height","auto");
      

}

function hideMenu(val)
{
        $(val).children("ul").hide();

}
  
function calcHeight(the_iframe)
{        
    var the_height=document.getElementById(the_iframe).contentWindow.document.body.scrollHeight;//find the height of the internal page
    document.getElementById(the_iframe).style.height=the_height;//change the height of the iframe
}    

