﻿/*******************
 functions by Chad
    TECHSAILOR
       2007
     - START -
    
   last edit - Feb/26/2008  
********************/

// JScript File

// getQuery() gets param QueryString
function getQuery(name)
{
    var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r!=null) return unescape(r[2]); 
    return "";
}

function changeSpanInnerHtmlByTimeout(objSpan, strMsg, intTimeout)
{
    var rate = 15;
    var step = 1;

    if(intTimeout > 0)
    {
        intTimeout -= step;
//        if(intTimeout < 0) { intTimeout = 0; }
        setTimeout(function() { changeSpanInnerHtmlByTimeout(objSpan, strMsg, intTimeout); }, rate);        
    }else
    {
        objSpan.innerHTML = strMsg;
    }
}

function clearSpanInnerHtmlByTimeout(objSpan, intTimeout)
{
    changeSpanInnerHtmlByTimeout(objSpan, "", intTimeout);
}

String.prototype.Trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.LTrim = function()
{
    return this.replace(/(^\s*)/g, "");
}

String.prototype.RTrim = function()
{
    return this.replace(/(\s*$)/g, "");
} 

function redirect(url)
{    
    window.location.replace(url);
}

function showHTMLObject(objHTMLTag)
{
    objHTMLTag.style.display = "block";
} 

function hideHTMLObject(objHTMLTag)
{
    objHTMLTag.style.display = "none";
} 

/**** added by Chad - Feb/26/2008 ****/
function toggleObjectClassName(obj, strClassName)
{        
    obj.className = strClassName;
}

function toggleObjectVisibility(objDiv, strVisibility)
{
    obj1.style.display = strVisibility;
}

