function checkFormValue(formObj, defaultValue)
{
    if (formObj.value == defaultValue) {formObj.value = "" ;}
}

function popup(targetURL,windowName,windowHeight,windowWidth)
{
    var newWin = window.open(targetURL,windowName,"scrollbars=1,menubar=no,width=" + windowWidth + ",height=" + windowHeight + ",toolbar=no") ;
}

function URLEncode(targetStringToEncode)
{
    validChars       = "0123456789" +                 // Numeric
                       "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
                       "abcdefghijklmnopqrstuvwxyz" + 
                       "-_.!~*'()" ;                  // RFC2396 Mark characters
    hexChars         = "0123456789ABCDEF" ;
    newEncodedString = "" ;
    
    for (i=0;i<targetStringToEncode.length;i++)
    {
        currentChar = targetStringToEncode.charAt(i) ;
        
        if (currentChar == " ")
        {newEncodedString += "+" ;}
        else if (validChars.indexOf(currentChar)!=-1)
        {newEncodedString += currentChar ;}
        else
        {
            currentCharCode = currentChar.charCodeAt(0) ;
            
            if (currentCharCode > 255)
            {
                alert( "Unicode Character '" + currentChar + "' cannot be encoded using standard URL encoding.\n(URL encoding only supports 8-bit characters.)\nA space (+) will be substituted.") ;
                newEncodedString += "+" ;
            }
            else
            {
                newEncodedString += "%" ;
                newEncodedString += hexChars.charAt((currentCharCode >> 4) & 0xF) ;
                newEncodedString += hexChars.charAt(currentCharCode & 0xF) ;
            }
        }
    }
    
    return newEncodedString ;
}

function GetXmlHttpObject(handler)
{
    var objXmlHttp = null;
    
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...");
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP";
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP";
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName);
            objXmlHttp.onreadystatechange=handler;
            return objXmlHttp;
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled");
            return;
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest();
        objXmlHttp.onload=handler;
        objXmlHttp.onerror=handler;
        return objXmlHttp;
    }
}

var flashObjArr = new Array();
function writeFlashObjs(isNotTransparent)
{
    for (var i=0;i<flashObjArr.length;i++)
    {
        //flashContainerID,height,width,targetFlashFile,altText,isTransparent
        thisFlashArr = flashObjArr[i].split(",") ;
        
        flashHTML  = "<object type=\"application/x-shockwave-flash\" data=\"" + thisFlashArr[3] + "\" width=\"" + thisFlashArr[2] + "\" height=\"" + thisFlashArr[1] + "\" id=\"flash_" + thisFlashArr[0] + "\" align=\"middle\" alt=\"" + thisFlashArr[4] + "\">" ;
        flashHTML += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />" ;
        flashHTML += "<param name=\"movie\" value=\"" + thisFlashArr[3] + "\" />" ;
        if (!isNotTransparent) {flashHTML += "<param name=\"wmode\" value=\"transparent\" />" ;}
        flashHTML += "</object>" ;
        
        thisContainerObj = document.getElementById(thisFlashArr[0]);
        thisContainerObj.innerHTML = flashHTML ;
    }
}

function popupWindow(targetURL)
{
    var newwin = window.open(targetURL);
    if (!newwin) {self.location = targetURL};
}