﻿// JScript File
function checkIE7Version()
{
    if(navigator.appName=="Microsoft Internet Explorer")
        {
        var IE_VER=navigator.appVersion;
        IE_VER=IE_VER.substr(22,3);
        if(IE_VER=="7.0")
            return true;
        }
    return false;
}
var SignWizard_IspopupVisible = false;
function SignWizard_GetTopPoint()
{	
    var iVal;
    if(browser=navigator.appName=="Microsoft Internet Explorer")
	{
	    iVal = ((document.body.clientHeight - document.getElementById("SignWizard_popup").clientHeight) / 2);
    }
	else
	{
	    iVal = ((document.getElementById("SignWizard_popup").clientHeight) / 2);
    }
    iVal = (iVal > 300)? 100 : iVal;
	return (iVal > 0 )? iVal : 0;   
}
function SignWizard_GetLeftPoint()
{
    var iVal = ((document.body.clientWidth - document.getElementById("SignWizard_popup").clientWidth) / 2);
    return (iVal > 0 )? iVal : 0;
}
function SignWizard_SetPopup(url, mode, method)
{
    try{document.getElementById("htmlHead").style.overflow="hidden";}
    catch(ex){}

    if (SignWizard_IspopupVisible != true) return;
    
    if (mode == "wizard_LoginOnly")
    {        
        document.getElementById("SignWizard_popup").className = "SignWizard_popup_LoginOnly";
        document.getElementById("SignWizard_popup_Iframe").className = "SignWizard_popup_Iframe_LoginOnly";
    }
    else
    {
        document.getElementById("SignWizard_popup").className = "SignWizard_popup";
        document.getElementById("SignWizard_popup_Iframe").className = "SignWizard_popup_Iframe";
    }
    scrollByUser_Top=document.documentElement.scrollTop+document.body.scrollTop;
    
    document.getElementById("SignWizard_Gray_Layer").style.display = "block";
    document.getElementById("SignWizard_popup").style.display = "block";
    document.getElementById("LG_wizard_close").style.display = "block";
    
    document.getElementById("SignWizard_popup").style.top = SignWizard_GetTopPoint() + scrollByUser_Top + "px";
    document.getElementById("LG_wizard_close").style.top = SignWizard_GetTopPoint() + scrollByUser_Top-14 + "px";
    
    document.getElementById("SignWizard_popup").style.left = SignWizard_GetLeftPoint()  + "px";
    document.getElementById("LG_wizard_close").style.left = SignWizard_GetLeftPoint()-14  + "px";
           
    document.getElementById("SignWizard_Gray_Layer").style.width = document.body.clientWidth;
    document.getElementById("SignWizard_Gray_Layer").style.height = document.body.clientHeight;
    
    document.getElementById('SignWizard_Gray_Layer').style.top=scrollByUser_Top +"px";    
        
    if (url!=null)
    {
        if (method=="get")
        {
            document.getElementById("SignWizard_popup_Iframe").src = url;        
        }
        else
        {
            var frm = document.getElementById("aspnetForm");
            if (frm) {
                frm.action = url;
                frm.target = "SignWizard_popup_Iframe";
                frm.submit();
            }
        }        
    }    
    SignWizard_IspopupVisible = true;
}        
function SignWizard_Show(url, mode, method) { 
    if (method!="post")
    {
        method="get";
    }
    
    if (checkIE7Version() == true)
    {
        document.getElementsByTagName("body")[0].scroll = "no";// ie7
    }
    else
    {
        document.getElementsByTagName('html')[0].style.overflow = 'hidden';
    }
    try {
        if (g) { g.StopPageReload = true; }
    } catch (e) { }
    SignWizard_IspopupVisible = true;
    SignWizard_SetPopup(url, mode, method)
}

function SignWizard_Close() {
    try {
        if (g) { g.StopPageReload = false; }
    } catch (e) { }
	document.getElementById("SignWizard_Gray_Layer").style.display = "none";
    document.getElementById("SignWizard_popup").style.display = "none";
    document.getElementById("LG_wizard_close").style.display = "none";
    SignWizard_IspopupVisible = false;
    try{document.getElementById("htmlHead").style.overflow="auto";}
    catch(ex){}
}		
document.write('<link href="http://www.globes.co.il/news/cache/wizard.css?ver=009" rel="stylesheet" type="text/css" />')
document.write('<div id="SignWizard_Gray_Layer" style="width:'+ (screen.width) + 'px; height:' + (screen.height) +'px; ">&nbsp;</div>');
document.write('<div id="LG_wizard_close" style="display:none; position:absolute; top:50px; z-index:205"><a id="SignWizard_Close_Anchor" href="javascript:SignWizard_Close();"><img src="http://images.globes.co.il/images/Site2/wizard/Icon_Close_v3.png" alt="סגור" width="28" height="28" border="0"></a></div>');
document.write('<div id="SignWizard_popup" class="SignWizard_popup">'
                + '<div style="float:left; clear:both;"><iframe frameborder="0" scrolling="no" class="SignWizard_popup_Iframe" id="SignWizard_popup_Iframe" name="SignWizard_popup_Iframe" src="about:blank"></iframe></div>' 
                + '</div>');

//g.onResize(SignWizard_SetPopup);

