
	function createCookie(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}

	function readCookie(name){
		var start = document.cookie.indexOf( name + "=" );
		var len = start + name.length + 1;
		if((!start) && (name != document.cookie.substring(0,name.length))) return null;

		if(start == -1) return null;
		var end = document.cookie.indexOf(";",len);
		if(end == -1) end = document.cookie.length;
		return unescape( document.cookie.substring( len, end ));
	}

	function eraseCookie(name) {
		createCookie(name,"",-1);
	}

// Removes leading whitespaces
	function LTrim( value ) {
		var re = /\s*((\S+\s*)*)/;
		return value.replace(re, "$1");
	}

// Removes ending whitespaces
	function RTrim( value ) {
		var re = /((\s*\S+)*)\s*/;
		return value.replace(re, "$1");
	}

// Removes leading and ending whitespaces
	function trim( value ) {
		return LTrim(RTrim(value));	
	}

// *** BROWSER VERSION ***
    var agt=navigator.userAgent.toLowerCase();
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

// Get windowWidth & windowHeight
	var windowWidth
	var windowHeight
	if(typeof(window.innerWidth) == 'number' )
	{	//Non-IE
		windowWidth = window.innerWidth;
		windowHeight = window.innerHeight;
	}else	if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
			{	//IE 6+ in 'standards compliant mode'
    			windowWidth = document.documentElement.clientWidth;
    			windowHeight = document.documentElement.clientHeight;
			} else	if(document.body && ( document.body.clientWidth || document.body.clientHeight ) )
					{	//IE 4 compatible
						windowWidth = document.body.clientWidth;
						windowHeight = document.body.clientHeight;
			}

// Change Image

function ImageChange(obj,filename){
	obj.src=filename;
}

// Change TABBOX

function ChangeTAB(CurrentCat, CtrlID, CatID){
    var obj
    
    obj = document.getElementById(CtrlID + "TabHeader" + CurrentCat); if(obj)obj.className="item";
    obj = document.getElementById(CtrlID + "TabHeader" + CatID); if(obj)obj.className="itemSelected";

    obj = document.getElementById(CtrlID + "TabBody" + CurrentCat); if(obj)obj.style.display="none";
    obj = document.getElementById(CtrlID + "TabBody" + CatID); if(obj)obj.style.display = "";
   
    createCookie(CtrlID + "CookieTabBox", CatID, 1);
    return CatID;
}

// Search Click

function Search_Click(str,CID){
    var obj = document.getElementById(str);
    if(obj)
    {
        obj.value=trim(obj.value)
        if(obj.value!="")location="?CID=" + CID + "&Search=" + obj.value;
    }
}
