﻿function Popup(pageURL, title,w,h) {
if(w==0)
w=500;
if(h==0)
h=480;

var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);

var newwindow = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
if (window.focus) {newwindow.focus()}
return false;
	
} 

function Popupresize(pageURL, title,w,h) {
if(w==0)
w=500;
if(h==0)
h=480;

var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);

var newwindow = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=Yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
if (window.focus) {newwindow.focus()}
return false;
	
} 

function PopupDynamic(pageURL, title,w,h,resize) {
//pageURL must be valid address
//title must not have space
//w is width of popup
//h is height of popup
//resize is yes or no for popup resizable property
if(w==0)
    w= screen.width - Math.round( screen.width* 0.4) ;
if(h==0)
    h=screen.height - Math.round( screen.height* 0.3);
 
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);

var newwindow = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable='+resize+' , copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
if (window.focus) {newwindow.focus()}
return false;
	
} 

function HideMessageControl()
{    
    try
    {
       var msg1 = null; 
       msg1=  document.getElementById('msg');
       msg1.style.display='none';    
    }
    catch(e)
    {
    }
    msg.style.display='none';    
    msg.style.visibility='hidden';    
    hdnIsVisible = GetHTMLControl('hdnIsVisible');
    if(hdnIsVisible != null)
        hdnIsVisible.value = "false";    
}

function GetHTMLControl(strName)
{
    for(i=0;i<document.forms[0].length;i++)
    {
        e=document.forms[0].elements[i];
        if (e.id.indexOf(strName) != -1 )
        {
           return e;
        }        		
    }	
    return null;    
}

function GetHtmlElement(ElementName)
{
    var objHTMLElement = null;
//    if(navigator.appName == "Microsoft Internet Explorer")
//        return ElementName;  
    objHTMLElement = document.getElementById(ElementName);
    return objHTMLElement;
       
}
//Pass object 'this' and max length
function SetMaxMultiLineTextboxWidth(field,maxlimit) 
{
    if (field.value.length > maxlimit) // if too long...trim it!
        field.value = field.value.substring(0, maxlimit);
}

function Trim(sString) 
{
    if(typeof sString == 'undefined' || sString == '')
        return;
    while (sString.substring(0,1) == ' ')
    {
    sString = sString.substring(1, sString.length);
    }
    while (sString.substring(sString.length-1, sString.length) == ' ')
    {
    sString = sString.substring(0,sString.length-1);
    }
    return sString;
}

function EnableDisableadtDate(strCheckboxName, strAdtName)
{
    
    for(i=0;i<document.forms[0].length;i++)
	{		
	    e=document.forms[0].elements[i];
	    if (e.id.indexOf(strCheckboxName) != -1 )
	    {			 
	        chk = e;
	        break;   
        }
    }
    
    for(i=0; i<document.forms[0].length; i++)
	{			
		var obj=document.forms[0].elements[i];
		var strMonth = strAdtName + "_month";
		var strYear = strAdtName + "_year";
		var strDay = strAdtName + "_day";
		
	    if(obj.name.indexOf(strMonth) != -1)	
	    {	    
			mon=obj;			
			if(chk.checked)		
			    mon.disabled = false;
			else
		        mon.disabled = true;			      
	    }
	    if(obj.name.indexOf(strYear) != -1)	
	    {
	         year=obj;				
		     if(chk.checked)		
		            year.disabled = false;
		     else
		            year.disabled = true;			      
	    }
	    if(obj.name.indexOf(strDay) != -1)	
	    {
	         day=obj;				
		     if(chk.checked)		
		            day.disabled = false;
		     else
		            day.disabled = true;			      
	    }        
	}
}


//Feed Back Realted//

function JSFX_FloatDiv(id, sx, sy) {
    var ns = (navigator.appName.indexOf("Netscape") != -1);
    var d = document;
    var el = d.getElementById ? d.getElementById(id) : d.all ? d.all[id] : d.layers[id];
    var px = document.layers ? "" : "px";
    window[id + "_obj"] = el;
    if (d.layers) el.style = el;
    el.cx = el.sx = sx; el.cy = el.sy = sy;
    el.sP = function(x, y) { this.style.left = x + px; this.style.top = y + px; };

    el.floatIt = function() {
        var pX, pY;
        pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
		document.documentElement && document.documentElement.clientWidth ?
		document.documentElement.clientWidth : document.body.clientWidth;
        pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ?
		document.documentElement.scrollTop : document.body.scrollTop;
        if (this.sy < 0)
            pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
		document.documentElement.clientHeight : document.body.clientHeight;
        this.cx += (pX + this.sx - this.cx) / 8; this.cy += (pY + this.sy - this.cy) / 8;
        this.sP(this.cx, this.cy);
        setTimeout(this.id + "_obj.floatIt()", 40);
    }
    return el;
}

function DrawFeedBack() {
    var winW = 630, winH = 570;

    if (parseInt(navigator.appVersion) > 3) {
        if (navigator.appName == "Netscape") {
            winW = window.innerWidth;
            winH = window.innerHeight;
        }
        if (navigator.appName.indexOf("Microsoft") != -1) {

            var viewportwidth;
            var viewportheight;

            // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight

            if (typeof window.innerWidth != 'undefined') {
                viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
            }

            // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

            else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0) {
                viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
            }

            // older versions of IE

            else {
                viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
            }

            //document.write('<p>Your viewport width is '+viewportwidth+'x'+viewportheight+'</p>');
            winW = viewportwidth;
            winH = viewportheight;
        }
    }

    JSFX_FloatDiv("divTopLeft", 0, (winH / 2) - 80).floatIt();
}

//Feedback Realted
