﻿
window.onload = function() {
        var strCook = document.cookie;
        if (strCook.indexOf("!~") != 0) {
            var intS = strCook.indexOf("!~");
            var intE = strCook.indexOf("~!");
            var strPos = strCook.substring(intS + 2, intE);
            var div = document.getElementById("tree_link");
            if (div != null) {
                document.getElementById("tree_link").scrollTop = strPos;
            }
        }
}
    function SetDivPosition() {
        var intY = document.getElementById("tree_link").scrollTop;
        document.cookie = "yPos=!~" + intY + "~!";
    }
    
    function ShowImpl() {
        var strFocus = document.cookie;
        if (strFocus.indexOf("$") != -1) {
            var intS = strFocus.indexOf("$");
            var intE = strFocus.indexOf("%");
            var strPos = strFocus.substring(intS + 1, intE);
            if ((strPos != 1) && (strPos != 0)) {
                alert('Please select the section reference');
                return false;
            }
        }
        var s = document.URL;
        var y = s.split("/");
        var specname = y[y.length - 2];
        var temp = y[y.length - 1];
	if(temp.indexOf("#")!= -1)	
	{
 		
	 temp = temp.substring(	0,temp.indexOf("#"));

	}
        temp = temp.substr(0, temp.length - 5);
        var dom = document.URL.substr(7, (document.URL.length - 8));
        var dom1 = dom.substr(0, dom.indexOf("/"));
        var newurl = "http://" + dom1 + '/implnotes/implementationnotelist.aspx?id=' + temp + "&specname=" + specname;
        newwindow = window.open(newurl, 'diisite', 'scrollbars=1,resizable=1,toolbar=0,width=800,height=600,top=50,left=50');
        newwindow.focus();
        return false;
    }

    function ShowNotes(){
        var strFocus = document.cookie;
        if (strFocus.indexOf("$") != -1) {
            var intS = strFocus.indexOf("$");
            var intE = strFocus.indexOf("%");
            var strPos = strFocus.substring(intS + 1, intE);
            if ((strPos != 1) && (strPos != 0)) {
                alert('Please select the section reference');
                return false;
            }
        }
        var s = document.URL;
        var y = s.split("/");
        var specname = y[y.length - 2];
        var temp = y[y.length - 1];
        if (temp.indexOf("#") != -1) {

            temp = temp.substring(0, temp.indexOf("#"));

        }
        temp = temp.substr(0, temp.length - 5);
        var dom = document.URL.substr(7, (document.URL.length - 8));
        var dom1 = dom.substr(0, dom.indexOf("/"));
        var newurl = "http://" + dom1 + '/implnotes/AddNote.aspx?SecRef=' + temp+'&SpecName='+specname;
        newwindow = window.open(newurl, 'diisite', 'scrollbars=1,resizable=1,toolbar=0,width=800,height=600,top=50,left=50');
        newwindow.focus();
        return false;
    }

    function showCoOwner(appId) {
        var s = document.URL;
        var y = s.split("/");
        var temp = y[y.length - 1];
        if (temp.indexOf("#") != -1) {

            temp = temp.substring(0, temp.indexOf("#"));

        }
        temp = temp.substr(0, temp.length - 5);
        var dom = document.URL.substr(7, (document.URL.length - 8));
        var dom1 = dom.substr(0, dom.indexOf("/"));
        var newurl = "http://" + dom1 + '/implnotes/coowner.aspx?appid=' + appId;
        newwindow = window.open(newurl, 'diisite', 'scrollbars=1,resizable=0,toolbar=0,width=400,height=270,top=300,left=300');
        newwindow.focus();
        return false;
    }
    function NavigateToForum() {
        var strFocus = document.cookie;
        if (strFocus.indexOf("$") != -1) {
            var intS = strFocus.indexOf("$");
            var intE = strFocus.indexOf("%");
            var strPos = strFocus.substring(intS + 1, intE);
            if ((strPos != 1) && (strPos != 0)) {
                alert('Please select the section reference');
                return false;
            }
        }
        var s = document.URL;
        var y = s.split("/");
        var temp = y[y.length - 1];
        if (temp.indexOf("#") != -1) {

            temp = temp.substring(0, temp.indexOf("#"));

        }
        temp = temp.substr(0, temp.length - 5);
        var dom = document.URL.substr(7, (document.URL.length - 8));
        var dom1 = dom.substr(0, dom.indexOf("/"));
        var newurl = "http://" + dom1 + '/threadlist.aspx?type=1&refid=' + temp;
        newwindow = window.location(newurl);
        return false;
    }

    function NavigateToLogin() {
        var strFocus = document.cookie;
        if (strFocus.indexOf("$") != -1) {
            var intS = strFocus.indexOf("$");
            var intE = strFocus.indexOf("%");
            var strPos = strFocus.substring(intS + 1, intE);
            if ((strPos != 1) && (strPos != 0)) {
                alert('Please select the section reference');
                return false;
            }
        }
        var s = document.URL;
        var y = s.split("/");
        var dom = document.URL.substr(7, (document.URL.length - 8));
        var dom1 = dom.substr(0, dom.indexOf("/"));
        var newurl = "http://" + dom1 + '/signin.aspx?retUrl=' + window.location;
        newwindow = window.location(newurl);
        return false;
    }