function rollImg(oImg)
{
	//Settings
	var sNormSuffix = "_no";
	var sOverSuffix = "_ov";
	var iStatusLen = sNormSuffix.length;

	//For manipulation only
	var sCurrentImgName = oImg.src.substring(oImg.src.lastIndexOf('/') + 1,oImg.src.length);
	var sCurrentStatus = sCurrentImgName.substr(sCurrentImgName.lastIndexOf('_'),iStatusLen);
	
	//Will be used for the final string building
	var sPath = oImg.src.substring(0,oImg.src.lastIndexOf('/') + 1);
	var sShortImgName = sCurrentImgName.substr(0,sCurrentImgName.lastIndexOf('_'));
	var sImgExt = sCurrentImgName.substring(sCurrentImgName.lastIndexOf('.'),sCurrentImgName.length);
	
	//New status
	var sNewStatus = ((sCurrentStatus == sNormSuffix) ? sOverSuffix : sNormSuffix);
	
	var sNewImgName = sPath + sShortImgName + sNewStatus + sImgExt;
	
	oImg.src = sNewImgName;
}

function toggleImg(sImgName)
{
	//For manipulation only
	var oImg = getObj(sImgName);
	var sCurrentImgName = oImg.src.substring(oImg.src.lastIndexOf('/') + 1,oImg.src.length);
	var sCurrentStatus = sCurrentImgName.substring(sCurrentImgName.lastIndexOf('_'),sCurrentImgName.lastIndexOf('.'));
	
	//Will be used for the final string building
	var sPath = oImg.src.substring(0,oImg.src.lastIndexOf('/') + 1);
	var sShortImgName = sCurrentImgName.substr(0,sCurrentImgName.lastIndexOf('_'));
	var sImgExt = sCurrentImgName.substring(sCurrentImgName.lastIndexOf('.'),sCurrentImgName.length);
	
	//New status
	var sNewStatus = ((sCurrentStatus == '_on') ? '_off' : '_on');
	
	var sNewImgName = sPath + sShortImgName + sNewStatus + sImgExt;
	
	oImg.src = sNewImgName;
}

function fo(theObj, theDoc)
{
    var p, i, foundObj;

    if(!theDoc) theDoc = document;
    if( (p = theObj.indexOf('?')) > 0 && parent.frames.length)
    {
        theDoc = parent.frames[theObj.substring(p+1)].document;
        theObj = theObj.substring(0,p);
    }
    if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
    
    for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
    
    for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = fo(theObj,theDoc.layers[i].document);
    
    if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

    return foundObj;
}

function createRequest()
{
	var oReq=null;
	try{
		oReq=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e){
		try{
			oReq=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(sc){
			oReq=null;
		}
	}
	
	if(!oReq&&typeof XMLHttpRequest!="undefined"){
		oReq=new XMLHttpRequest();
	}
	
	return oReq;
}

function exeOnEnterKey(e, refFunction)
{
	var e = (e)? e : event;
	var nCode;
    
    if(e.charCode)
		nCode = e.charCode
    else
		nCode = (e.which) ? e.which : e.keyCode;
	
	if(nCode == 13 || nCode == 3)
	{
		refFunction();	
	} 
}

function trim(str){
   return str.replace(/^\s*|\s*$/g,"");
}

function buildTableElement(sId,sName,sCellPadding,sCellSpacing,sBorder){
    var oTable = null;

    try{
        sTableHTML = '<table';
        if(sCellPadding) sTableHTML += ' cellpadding=\"' + sCellPadding + '\"';
        if(sCellSpacing) sTableHTML += ' cellspacing=\"' + sCellSpacing + '\"';
        if(sBorder) sTableHTML += ' border=\"' + sBorder + '\"';
        if(sName) sTableHTML += ' name=\"' + sName + '\"';
        if(sId) sTableHTML += ' id=\"' + sId + '\"';
        sTableHTML += ">"
        
        oTable = document.createElement(sTableHTML);
    }catch(e){
        oTable = document.createElement('TABLE');
        if(sCellPadding)oTable.setAttribute('cellpadding',sCellPadding);
        if(sCellSpacing) oTable.setAttribute('cellspacing',sCellSpacing);
        if(sBorder)oTable.setAttribute('border',sBorder);
        if(sName)oTable.setAttribute('name',sName);
        if(sId)oTable.setAttribute('id',sId);
    }
    
    return oTable;
}

function getElementPos(oElement)
{
    var oGeo = {x:0, y:0, height:0, width:0};
	
    oGeo.height = oElement.offsetHeight;
    oGeo.width = oElement.offsetWidth;
    if(oGeo.height == 0 && oGeo.width == 0 && typeof oElement.width != 'undefined')
    {
        oGeo.height = oElement.height;
        oGeo.width = oElement.width;
    }
	
    if (oElement.offsetParent)
    {
        while (oElement)
        {
            oGeo.x += oElement.offsetLeft;
            oGeo.y += oElement.offsetTop
            oElement = oElement.offsetParent;
        }
    }
    else if (oElement.x)
    {
        oGeo.x += oElement.x;
        oGeo.y += oElement.y;
    }
	
    return oGeo;
}

function URLEncode(sURL) 
{ 
    sURL = escape(sURL); 
	
	re = new RegExp("/","g")
    sURL = sURL.replace(re,"%2F"); 
    
    return sURL; 
}
