﻿// JScript File

function CheckEmail(object)
{
    var pattern = /^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+){1,4}$/;
    return pattern.test(object);
}

function openWinMin(url)
{
	 var newwin=window.open(url,"_blank","top=150,left=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=643,height=600");
	 return false;
}

function openWin(url)
{
	 window.open(url,"_blank","top=50,left=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600");
	 return false;
}

function popupPrintResult(strUrl)
{
    window.open(strUrl,'newwindow','left=0,top=0,height=650, width=700, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes');
    //return false;
}

function searchFunction()
{
    if(event.keyCode == '13'){ return false;}
}

function getStockPrice()
{
    return '90.21';
}

function setfooter(){

    //var headerHeight = document.getElementById("header").scrollHeight;
    var pagebodyHeight = document.getElementById("pageContent").scrollHeight;
    var footerHeight = document.getElementById("footer").scrollHeight; 
    var allHeight = document.documentElement.clientHeight; 
    var footer = document.getElementById("footer"); 
    var footer_inside = document.getElementById("footer_inside"); 
   if((pagebodyHeight + footerHeight) < allHeight){
//       if(document.getElementById("consoletable") != null)
//       {
//            var c = document.getElementById("consoletable").scrollHeight;
//            footer.style.height = (allHeight - pagebodyHeight - c) + 'px';
//       }
//       else
//       {
//            footer.style.height = (allHeight - pagebodyHeight) + 'px';
//       }
       footer.style.height = (allHeight - pagebodyHeight) + 'px';
       footer_inside.style.position = "absolute"; 
       footer_inside.style.bottom = "0";
   }else{
       footer.style.position = ""; 
       footer.style.bottom = ""; 
   } 
   setTimeout(function(){setfooter();},10); 
}

if (document.all){
    window.attachEvent('onload',setFooter);
}
else{
    window.addEventListener('load',setFooter,false);
}

window.onresize = function() {
	setFooter(); 
}

function openModelWin()
{
    var url = document.all.hid.value;
    var s;
    if (navigator.userAgent.indexOf("Firefox") > 0)
    {
        s = window.open(url,null,"height=700,width=1024,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no,modal=yes");
        return false;
    }
    else
    {
        s = window.showModalDialog("/_catalogs/masterpage/IFramePage.aspx", url, "dialogWidth:1024px; dialogHeight:700px; center:Yes;");
                
        if(s == 'true') {
            return true;
        }
        return false;
    }
}

function agreeClose()
{
    if (navigator.userAgent.indexOf("Firefox") > 0)
    {
        var s = parent.window.opener.document.getElementById("NewSubscription1_btnSubmitData").id;
        //alert(s);
        parent.window.opener.document.getElementById("NewSubscription1_btnSubmitData").click();
        this.parent.close();
    }
    else
    {
        window.returnValue = "true";
        this.parent.close();
    }
}

function declineClose()
{
    window.returnValue = "false";
    this.parent.close();
}

function resizeIframe(iframeID) { 
    if(self==parent) return false; /* Checks that page is in iframe. */ 
    else if(document.getElementById&&document.all) /* Sniffs for IE5+.*/ 
    var FramePageHeight = framePage.scrollHeight + 20;
    parent.document.getElementById(iframeID).style.height=FramePageHeight; 
}