var val = "";
var logintext = "<link href='http://indiaeducation.net/common/css/login.css' rel='stylesheet' type='text/css' />";
logintext = logintext + "<div id='Gradient_Login' style='background-image: url(http://s4i.indiaeducation.net/search/images/bac.gif);'></div>";
logintext = logintext + "<div id='Login' class='Login' style='position:fixed;'><center><div class='Closepanel'><img src='http://s4i.indiaeducation.net/search/images/close-x.png' alt='Close' class='Closepanelimg' onclick='CloseLoginPanel_common()' title='Close' id='CloseLocationImg' style='display:none;' />";
logintext = logintext + "<img src='http://indiaeducation.net/img/transparent.png' style='cursor: pointer;float: right;position:absolute;margin-left:27px;margin-top:319px;' onclick='CWL_common()' id='Img1' />";
logintext = logintext + "<iframe id='Loginframe' name='Loginframe' src='http://indiaeducation.net/common/login.aspx?url=" + document.location.href + "' class='iframe' scrolling='no' frameborder='0'></iframe></div></center></div><form id='v3_form' name='v3_form' method='post' action='http://indiaeducation.net/common/login.aspx?url=" + document.location.href + "' target='Loginframe'><input id='v3' name='v3' type='hidden'></form>";
document.write(logintext);

var popupStatus_common = 0;

//loading popup with jQuery magic!
function loadPopup_common(Layer_common) {
document.getElementById("Login").style.display = "block";
document.getElementById("Gradient_Login").style.display = "block";
document.getElementById("Gradient_Login").className = "BackInner_Login";

//    if (popupStatus_common == 0) {
//        $("#Gradient_Login").css({
//            "opacity": "0.7"
//        });
//        $("#Gradient_Login").fadeIn("slow");
//        $("#Back_login").fadeIn("slow");
//        $("#" + Layer_common).fadeIn("slow");
//        popupStatus_common = 1;
//        centerPopup_common(Layer_common);
//    }
}

//disabling popup with jQuery magic!
function disablePopup_common(Layer_common) {
    //disables popup only if it is enabled
//    if (popupStatus_common == 1) {
//        $("#Gradient_Login").fadeOut("slow");
//        $("#Back_login").fadeOut("slow");
//        $("#" + Layer_common).fadeOut("slow");
//        popupStatus_common = 0;
//    }
document.getElementById("Login").style.display = "none";
document.getElementById("Gradient_Login").style.display = "none";
document.getElementById("Gradient_Login").className = "";
}

//centering popup
function centerPopup_common(Layer_common) {
    //request data for centering
    
    var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var ScreenHeight = screen.height;
	var ScreenWidth = screen.width;
	var popupHeight = 600;
	var popupWidth = 1300;	
	var TopPos = Math.round((parseInt(screen.height) * 15) / 100);
	var LeftPos = Math.round((parseInt(screen.width) * 30) / 100);
	var TopHeight = Math.round((parseInt(windowHeight / 2.3) - parseInt(popupHeight / 2.3)));
	var LeftWidth = Math.round((parseInt(windowWidth / 2.3) - parseInt(popupWidth / 2.3)));

	var left = (screen.width / 2) - (popupWidth / 2);
	var top = (screen.height / 2) - (popupHeight / 2);

    
    
    
    
   // var windowWidth = document.documentElement.clientWidth;
   // var windowHeight = document.documentElement.clientHeight;
//    var popupHeight = $("#" + Layer_common).height();
//    var popupWidth = $("#" + Layer_common).width();
//alert(windowHeight);alert(windowHeight/12);
     document.getElementById(Layer_common).style.top = top + "px";
  //   document.getElementById(Layer_common).style.left = left + "px";
    document.getElementById("CloseLocationImg").style.display = "block";

//    //centering
//    $("#" + Layer_common).css({
//        "position": "absolute",
//        "top": windowHeight / 2 - popupHeight / 2 + document.documentElement.scrollTop,
//        "left": windowWidth / 2 - popupWidth / 2
//    });
//    $("#Back_login").css({
//        "position": "absolute",
//        "top": windowHeight / 2 - popupHeight / 2 + 16 + document.documentElement.scrollTop,
//        "left": windowWidth / 2 - popupWidth / 2
//    });

//    //only need force for IE6	
//    $("#Gradient_Login").css({
//        "height": windowHeight
//    });
}


////CONTROLLING EVENTS IN jQuery
//$(document).ready(function() {
//    //Scroll event!
//    $(window).scroll(function() {
//        //centering with css
//        if (document.getElementById("Gradient_Login").style.display != "none") {
//            if (document.getElementById("Login").style.display != "none") {
//                centerPopup_common("Login");
//            }
//        }
//    });

//    //CLOSING POPUP
//    $("#Back_login").click(function() {
//    if (document.getElementById("Login").style.display != "none") {
//        disablePopup_common("Login");
//        }
//    });
//    //Click out event!
//    $("#Gradient_Login").click(function() {
//    if (document.getElementById("Login").style.display != "none") {
//        disablePopup_common("Login");
//        }
//    });
//    //Press Escape event!
//    $(document).keypress(function(e) {
//        if (e.keyCode == 27 && popupStatus_common == 1) {
//            if (document.getElementById("Login").style.display != "none") {
//                disablePopup_common("Login");
//            }
//        }
//    });
//});
function CloseLoginPanel_common() {
    disablePopup_common("Login");
}
function CWL_common() {
    disablePopup_common("Login");
}
function common_login() {
        centerPopup_common('Login');
        loadPopup_common('Login');
    }
    function common_login_state(v) {
        document.v3_form.v3.value = v;
        document.v3_form.submit();
        setTimeout("centerPopup_common('Login')", 500);
        setTimeout("loadPopup_common('Login')", 500);
    }
    function common_login_state_alert(v) {
        document.v3_form.v3.value = v;
        document.v3_form.submit();
        alert('You need to Login first.');
        setTimeout("centerPopup_common('Login')", 500);
        setTimeout("loadPopup_common('Login')", 500);
    }
 function Logout() {
     window.location.href = "http://indiaeducation.net/common/Edupallogout.aspx?logout=" + location.href;
 }
 function Session_Logout()
 {
 window.location.href = "http://indiaeducation.net/Logout.aspx?url=" + location.href;
}

function setstate(value) {
    var expiredays = "1";
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = "StateValue=" + escape(value) +
((expiredays == null) ? "" : ";expires=" + exdate.toUTCString());
}

function getstate() {
    var c_name = "StateValue";
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}
function querySt(ji) {
    hu = window.location.search.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) {
            return ft[1];
        }
return "";
    }
}
