<!--
// common javascpt functions
// www.tgasoft.com

function changeObjectCssClass(obj,newCssClass)
{
    if(obj != null)
    {
        obj.className = newCssClass;
    }
}
        
function showHideElement(elmName)
{
	var gId = document.getElementById(elmName).style;
	if (gId  != null)
	{
 	    if(gId.display == "block")
	    {
		    gId.display = "none";
	    }
	    else{
		    gId.display = "block";
	    }
	}
}	

function showElement(elmName)
{
	var gId = document.getElementById(elmName).style;
	
 	if (gId  != null)
	{
 	    gId.display = "block";
	}
}

function hideElement(elmName)
{
	var gId = document.getElementById(elmName).style;
	
 	if (gId  != null)
	{
        gId.display = "none";
	}
}

function writeMessage(elmName,message)
{
    var gId = document.getElementById(elmName);
 	if (gId  != null)
	{
	    gId.innerHTML = message;
	}
}

function replaceStupidly(str,what,to)
{
     str = str.replace(what,to);  
     str = str.replace(what,to);  
     str = str.replace(what,to);  
     str = str.replace(what,to);  
     str = str.replace(what,to);  
     str = str.replace(what,to);  
    return str;
}

function scrollDown()
{
    window.scrollTo(0,10000);
}
        
function GoUrl(urlStr){
	document.location.href = urlStr
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}


function OpenSizeWindow(a_url,a_name,a_width,a_height)
{
	var strHelpOptions = "location=no";
	strHelpOptions += ",toolbar=no";
	strHelpOptions += ",menubar=no";
	strHelpOptions += ",status=no";
	strHelpOptions += ",scrollbars=no";
	strHelpOptions += ",resizable=no";
	strHelpOptions += ",top=300";
	strHelpOptions += ",left=300";
	strHelpOptions += ",width="+a_width;
	strHelpOptions += ",height="+a_height;

	window.open(a_url, a_name, strHelpOptions);
}
/********************************************************************/
/*      AJAX COMMON FUNCS                                           */
/********************************************************************/

function GetXmlHttpObject(handler)
{ 
    var objXmlHttp = null;
    if (!window.XMLHttpRequest)
    {
        // Microsoft
        objXmlHttp = GetMSXmlHttp();
        if (objXmlHttp != null)
        {
            objXmlHttp.onreadystatechange = handler;
        }
    } 
    else
    {
        // Mozilla | Netscape | Safari
        objXmlHttp = new XMLHttpRequest();
        if (objXmlHttp != null)
        {
            objXmlHttp.onload = handler;
            objXmlHttp.onerror = handler;
        }
    } 
    return objXmlHttp; 
} 

function GetMSXmlHttp()
{
    var xmlHttp = null;
    var clsids = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0",
                 "Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0", 
                 "Msxml2.XMLHTTP.2.6","Microsoft.XMLHTTP.1.0", 
                 "Microsoft.XMLHTTP.1","Microsoft.XMLHTTP"];
    for(var i=0; i<clsids.length && xmlHttp == null; i++) {
        xmlHttp = CreateXmlHttp(clsids[i]);
    }
    return xmlHttp;
}

function CreateXmlHttp(clsid) {
    var xmlHttp = null;
    try {
        xmlHttp = new ActiveXObject(clsid);
        lastclsid = clsid;
        return xmlHttp;
    }
    catch(e) {}
}

function SendXmlHttpRequest(xmlhttp, url) { 
    xmlhttp.open('GET', url, true); 
    xmlhttp.send(null); 
}
/*********************************************************************
SPECIFIC!!
var xmlHttp; 

function ExecuteCall(url)
{ 
   
    try 
    { 
        xmlHttp = GetXmlHttpObject(CallbackMethod); 
        xmlHttp.onreadystatechange  =  CallbackMethod;//ie7
        SendXmlHttpRequest(xmlHttp, url); 
    }
    catch(e){} 
} 
    
//CallbackMethod will fire when the state 
//has changed, i.e. data is received back 
function CallbackMethod() 
{ 
   //alert(xmlHttp.readyState);
    try
    {
        //alert(xmlHttp.readyState);
        //readyState of 4 or 'complete' represents 
        //that data has been returned 
        if (xmlHttp.readyState == 4 || 
            xmlHttp.readyState == 'complete')
        {
            var response = xmlHttp.responseText; 
            if (response.length > 0)
            {
                //update page
                document.getElementById("elementId").innerHTML = response; 
			//	alert(response);
            } 
        }
    }
    catch(e)
    {
		alert("err:" + e);
    }
}

	function dojax()
	{
		var str = "http://localhost/ajaxtest/getTemp.aspx?temp=";
		str += document.Form1.vvv.value;
		ExecuteCall(str);
		*/
//-->




function ff()
{
	var startX = 10,
	startY = 120;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(null == el)
		{
		    return;
		}
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		el.y = startY;
		return el;
	}
	window.stay=function()
	{
		try{
		//alert(d.body);
		var space=d.body.clientWidth-760-260;
		if(space <= 0) ftlObj.style.display="none";
		else ftlObj.style.display="block";
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stay()", 10);
		}catch(e){}
	}
	ftlObj = ml("waterMark");
	stay();
}
ff();
