﻿function hide(o)
{
    document.getElementById(o).style.display='none';
}
function applicationLoad()
{
    Sys.WebForms.PageRequestManager.propertyChanged.add(
        function(obj, e)
        {
            if (e.get_propertyName() == "inPostBack")
            {
                if(obj.get_inPostBack()) 
                {
                    disableAll();
                }
            }
        }
    );
 }
function disableAll()
{
    var dml=document.forms[0];
    var len = dml.elements.length;
    var i=0;
    for( i=0 ; i<len ; i++) 
    {
        dml.elements[i].disabled=true;
        
    }
    //    dml=document.anchors;
    //    len = dml.length;
    //    i=0;
    //    for( i=0 ; i<len ; i++) 
    //    {
    //        dml[i].disabled=true;
    //        
    //    }
}
function lineItem(vals,d,a,t)
{
    //alert(vals);
    var ar = vals.split("||");
    var c = document.getElementById(t).checked;
    
    document.getElementById(d).value = ar[0];
    document.getElementById(d).focus();
    for(w=0;w<10000;w++)
    {
        void(0);
    }
    document.getElementById(a).value = ar[1];
    document.getElementById(a).focus();
    for(w=0;w<10000;w++)
    {
        void(0);
    }
    if(document.getElementById(t).checked == ar[2])
    {
        for(w=0;w<10000;w++)
        {
            void(0);
        }
        document.getElementById(t).click();
    }
    else
    {
        document.getElementById(t).click();
        for(w=0;w<10000;w++)
        {
            void(0);
        }
        document.getElementById(t).click();
    }
}
function closeFrame() 
{
	document.all.mainDiv.style.display = 'none';
	document.all.mainDiv.innerHTML = '<html></html>';		
}
function showFrame() 
{
	document.all.mainDiv.style.display = 'inline';
}
function hideDiv(which) 
{
	document.getElementById(which).style.display = 'none';
	document.all.mainDiv.innerHTML = '';
}
function showDiv(which) 
{
	hideDiv(which)
	document.getElementById(which).style.display = 'inline';
}
function loadFrame(loc,wdt,hgt,scr)
{
	var imgLoc = (wdt - 24);
	if(scr=='yes')
	{
		imgLoc = (wdt - 41)
	}
	document.all.mainDiv.style.top = window.event.y + document.body.scrollTop - 100;
	document.all.mainDiv.style.left = window.event.x - 50;
	document.all.mainDiv.innerHTML = "<img alt='Close Window' style='cursor:hand; position:absolute; top:1px; left:" + imgLoc + "px;z-index:1000;' onclick='closeFrame();' border='0' src='../../img/close_x.gif' /></font><iframe style='width:" + wdt + "px;height:" + hgt + "px;' src='" + loc + "' scrolling='" + scr + "' id='mainDivIFrame' name='mainDivIFrame' frameborder='0'></iframe>";
}
function addPlanPhoto(plans_id)
{
	showFrame();
	loadFrame('../add-photo.aspx?plans_id=' + plans_id, '480', '240', 'yes');
	document.frames["mainDivIFrame"].location.href=document.frames["mainDivIFrame"].location.href;
}
function pageWidth() 
{
    return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
}
function pageHeight() 
{
    return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
}
function posLeft()
{
    return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;
}
function posTop()
{
    return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;
}
function posRight()
{
    return posLeft()+pageWidth();
}
function posBottom()
{
    return posTop()+pageHeight();
}