﻿//// JScript File

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
var tipobj

function hideMultiView()
{
    document.getElementById("CtlShowDocument1_multiViewTd").className = "Hide_ShowDocumentDiv";
    document.getElementById("CtlShowDocument1_repeaterTd").style.width = "100%";
    document.getElementById("CtlShowDocument1_repeaterTd").colSpan = 3;
}

function SetCookie(name, value, expires, path, domain, secure)
{
	document.cookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}

function GetCookie(name, dflt)
{
	var prefix = name + "=";
	var index1 = document.cookie.indexOf(prefix);

	if (index1 == -1)
		return dflt;

	var index2 = document.cookie.indexOf(";", index1 + prefix.length);

	if (index2 == -1)
		index2 = document.cookie.length;

	return unescape(document.cookie.substring(index1 + prefix.length, index2));
}

function DelCookie(name, path, domain)
{
	if (GetCookie(name))
	{
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function OpenDocument(a, Docid ,link , target)
{
	//debugger;
	var i = "a";
	//if (GetCookie("user"))
	var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);     
    if (sPage == "wfShowDocument.aspx")
	{
	    if (document.getElementById("CtlShowDocument1$HidIdentify").value == "True")
	    {
            setLinkParam(a,Docid);
	    }
	    else
	    {
	        showDiv(1);		    
	    }
	}
	else
	{
	    if (document.getElementById("HidIdentify").value == "True")
	    {
            setLinkParam(a,Docid);
	    }
	    else
	    {
	        showDiv(1);		    
	    }
	}	
}

function setLinkParam(a,Docid)
{
    a.style.textDecoration="underline";
	a.href = "wfShowDocument.aspx?DocumentId="+Docid;
    a.target = "_blank";
}

function openDocumentFromMail(Docid)
{
	//debugger;	
	//if (GetCookie("user"))
	if (document.getElementById("HidIdentify").value == "True")
	{
        window.open("wfShowDocument.aspx?DocumentId="+Docid);
        //window.open('wfShowDocument.aspx?DocumentId='+Docid,'','width='+window.screen.availWidth+',height='+window.screen.availHeight+',status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,titlebar=yes');                    
	}
	else
	{
	    showDiv(1);
		//alert("הכניסה מורשית למנויי כל-עתיד");
	}
}

function showDiv(actionId)
{
    if(actionId == 1)
    {
	    document.getElementById("ctl00_ContentPlaceHolder1_divIdentify").className = 'docOpen_div';
	    //document.getElementById("ctl00_ContentPlaceHolder1_divIdentify").className = 'docOpen_div';
    }
    else
    {
	    document.getElementById("ctl00_ContentPlaceHolder1_divIdentify").className = 'hiddenDiv';
    }
		    window.scrollTo(0,0)
}

function hideDiv()
{
    //debugger;
    document.getElementById("ctl00_ContentPlaceHolder1_divIdentify").className = 'HideHomePageDiv';
    window.scrollTo(0,0)
}

function hideDivOrder()
{
    //debugger;
    document.getElementById("ctl00_ContentPlaceHolder1_divOrderType").className = 'HideHomePageDiv';
    window.scrollTo(0,0)
}

function hidedMessageBox()
{
    //debugger;
    document.getElementById("ctl00_ContentPlaceHolder1_TabSearch1_dMessageBox").style.display = 'none';
    //window.scrollTo(0,0)
}
function hideUpdateMessage()
{
    //debugger;
    document.getElementById("ctl00_ContentPlaceHolder1_System1_UpdateUserInfo").style.display = 'none';
    window.scrollTo(0,0)
}

function backToTop()
{     	
	document.getElementById("cmbAmendment").focus();	    
}

function changeStyle(id,color)
{
    //debugger;    
    document.getElementById(id).style.bgColor = "red";    
}

function ChangeToRepeater()
{
     document.getElementById("CtlShowDocument1_divRepeater").className = "DocumentContentRepeaterShow";     
     document.getElementById("CtlShowDocument1_divRepTolls").className = "RepToolsHide";
     document.getElementById("CtlShowDocument1_divFrame").className = "IframeHide";
     //document.getElementById("CtlShowDocument1_Iframe1").className = "IframeHide";
}

function ChangeToIframe()
{
     document.getElementById("CtlShowDocument1_divRepTolls").className = "RepToolsShow";
     document.getElementById("CtlShowDocument1_divFrame").className = "IframeShow";
     //document.getElementById("CtlShowDocument1_Iframe1").className = "IframeShow";   
     document.getElementById("CtlShowDocument1_divRepeater").className = "DocumentContentRepeaterHide";
}

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

//function SetTermsFrameParam()
//{
//    var ieVer = document.getElementById("ctl00$ContentPlaceHolder1$HidBrowserId").value;    
//    var frameHeight;
//    var fullscreen = window.screen.Height;    
//    var avail = window.screen.availHeight;     
//    //var bottom = fullscreen - avail;    
//    if (ieVer == "6.0")
//    {
//        frameHeight = document.body.offsetHeight;
//    }
//    else 
//    {
//        frameHeight = document.body.parentElement.offsetHeight;
//    }
//    document.getElementById("ctl00_ContentPlaceHolder1_Terms1_iframe1").style.height = frameHeight;
//}

function SetframeParam()
{
    //debugger;
    var ieVer = document.getElementById("CtlShowDocument1_HidBrowserId").value;    
    var frameHeight;
    var fullscreen = window.screen.Height;        
    //document.getElementById("tblShow").style.height = document.body.offsetHeight;
    
    var avail = window.screen.availHeight;     
    if (ieVer == "6.0")
    {
        //top.moveTo(0,0);
        top.resizeTo(window.screen.width,window.screen.height)        
        frameHeight = document.body.offsetHeight-document.getElementById("CtlShowDocument1_Iframe1").offsetTop-26;                                
	    //document.getElementById('the_iframe').contentWindow.document.body.scrollHeight
	    //frameHeight = document.body.offsetHeight - 46;
    }
    else 
    {
        parent.window.resizeTo(window.screen.width,window.screen.availHeight);
        frameHeight = document.body.parentElement.offsetHeight - 46;
    }
   document.getElementById("CtlShowDocument1_Iframe1").style.height = frameHeight;
   document.getElementById("CtlShowDocument1_multiViewTd").style.height = frameHeight - 34;
}

//function SetframeMivzak()
//{
//    //debugger;
//    var ieVer = document.getElementById("ctl00_ContentPlaceHolder1_HidBrowserId").value;    
//    var frameHeight;
//    //var fullscreen = window.screen.Height;    
//    //var avail = window.screen.availHeight;     
//    if (ieVer == "6.0")
//    {
//        //top.moveTo(0,0);
//        //top.resizeTo(window.screen.width,window.screen.height)        
//        if (window.screen.height == 600)
//            frameHeight = 340;
//        else       
//            frameHeight = window.screen.height - 175 - 169;
//        //frameHeight = document.body.offsetHeight - 175;
//    }
//    else 
//    {
//        //parent.window.resizeTo(window.screen.width,window.screen.availHeight);
//        frameHeight = document.body.parentElement.offsetHeight - 175;
//    }
//   document.getElementById("ctl00_ContentPlaceHolder1_Mivzak1_iframe1").style.height = frameHeight;
//   //document.getElementById("ctl00_tdRightSide").style.height = frameHeight;         
//}

function SendAlert(message)
{
    //debugger;
    alert(message);
}

function openEventWindow()
{
    window.open("http://www.hashavim.co.il/instructionHomePage.aspx?id=5");
}

function setDisplay(imgId,trId)
{
    //debugger;
    if (document.images[imgId].nameProp == 'Plus.gif')
    {
        document.images[imgId].src = 'Images/Minus.gif';
        document.getElementById(trId.id).className = 'ShowTr'; 
    }
    else
    {
        document.images[imgId].src = 'Images/Plus.gif';
        document.getElementById(trId.id).className = 'HidTr';
    }   
    //document.getElementById(trId.id).className = "ShowTr";    
}

function setDisplayLinkClick(trId)
{
    debugger;
    if (document.getElementById(trId.id).className = 'ShowTr')
        document.getElementById(trId.id).className = 'HidTr';
    else
        document.getElementById(trId.id).className = 'ShowTr';        
}

function openAncor(artId)
{
	parent.doc_txt.location.hash = artId;
}

function openDocumentWithAnchor(a , docId , artId)
{
    var i = "a";
	if (GetCookie("user"))
	{
        a.style.textDecoration="underline";
	    a.href = "wfShowDocument.aspx?DocumentId="+docId+"&Ancr="+artId;
		a.target = "_blank";
	}
	else
	{
	    showDiv(1);
		//alert("הכניסה מורשית למנויי כל-עתיד");
	}                                    
}
function checkWindowOpener()
{                
    //debugger;       
    if (window.opener == null)
    {                      
        var str = document.location.search;
        var temp = new Array();         
        temp = str.split('=');
        var docId = temp[temp.length - 1];
        parent.location.href("wfShowDocument.aspx?documentId="+docId);                              
    }  
}

//function searchInDocument(ancrId)
//{
//    debugger;
//    //parent.doc_txt.location.hash = artId;
//}
function LoadXmlTree(documentID , tdTool , divToShow , type)
{
    //debugger;
    if (document.getElementById("CtlShowDocument1_HidTdXml").value == "")
    {
        document.getElementById("CtlShowDocument1_HidTdXml").value = tdTool;
        document.getElementById("CtlShowDocument1_HidDivId").value = divToShow;
        document.getElementById("CtlShowDocument1_DocumentMap1_DocMapFrame").src = "DocumentMap.ashx?documentId="+documentID;
        ChangeShowDocumentSettings(document.getElementById("CtlShowDocument1_HidTdXml").value,document.getElementById("CtlShowDocument1_HidDivId").value);
        //SearchEngineToolServices.GetXmlTree(documentID,type,OnGetXmlTreeComplete,OnGetXmlTreeTimeOut,OnGetXmlTreeError);
    }
    else
        ChangeShowDocumentSettings(document.getElementById("CtlShowDocument1_HidTdXml").value,document.getElementById("CtlShowDocument1_HidDivId").value);
}

function ChangeButtonImage(button, img)
{
    button.src = img;
}

function searchInDocument(ancrId)
{
    //debugger;    
    parent.document.frames["CtlShowDocument1_Iframe1"].location.hash = ancrId;    
}
