var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
var is_ie6 = is_ie && ([/MSIE (\d)\.0/i.exec(userAgent)][0][1] == 6);
var is_ie7 = is_ie && ([/MSIE (\d)\.0/i.exec(userAgent)][0][1] == 7);
var is_mac = userAgent.indexOf('mac') != -1;
var charset='utf-8';
if(is_moz && window.HTMLElement) {
	HTMLElement.prototype.__defineSetter__('outerHTML', function(sHTML) {
        	var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var df = r.createContextualFragment(sHTML);
		this.parentNode.replaceChild(df,this);
		return sHTML;
	});

	HTMLElement.prototype.__defineGetter__('outerHTML', function() {
		var attr;
		var attrs = this.attributes;
		var str = '<' + this.tagName.toLowerCase();
		for(var i = 0;i < attrs.length;i++){
			attr = attrs[i];
			if(attr.specified)
			str += ' ' + attr.name + '="' + attr.value + '"';
		}
		if(!this.canHaveChildren) {
			return str + '>';
		}
		return str + '>' + this.innerHTML + '</' + this.tagName.toLowerCase() + '>';
        });

	HTMLElement.prototype.__defineGetter__('canHaveChildren', function() {
		switch(this.tagName.toLowerCase()) {
			case 'area':case 'base':case 'basefont':case 'col':case 'frame':case 'hr':case 'img':case 'br':case 'input':case 'isindex':case 'link':case 'meta':case 'param':
			return false;
        	}
		return true;
	});
	HTMLElement.prototype.click = function(){
		var evt = this.ownerDocument.createEvent('MouseEvents');
		evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
		this.dispatchEvent(evt);
	}
};
function $d(id) {
	return $("#"+id).length==1?$("#"+id)[0]:null;
};
function checkall(form, prefix, checkall) {
	var checkall = checkall ? checkall : 'chkall';
	count = 0;
	for(var i = 0; i < form.elements.length; i++) {
		var e = form.elements[i];
		if(e.name && e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
			e.checked = form.elements[checkall].checked;
			if(e.checked) {
				count++;
			}
		}
	}
	return count;
};
function checkidAll(form,iValue)
{
    for (var i=0;i < form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name == "id"){
       e.checked = iValue;
		}
	};
	var dvs=$d("managetrbody").getElementsByTagName("tr");
	for (var i=0;i<dvs.length;i++){
	  if (iValue==1)
	    dvs[i].style.backgroundColor="#ffb";
	  else
  	  dvs[i].style.backgroundColor="#fff";
	}
};
function doane(event) {
	e = event ? event : window.event;
	if(is_ie) {
		e.returnValue = false;
		e.cancelBubble = true;
	} else if(e) {
		e.stopPropagation();
		e.preventDefault();
	}
};
function fetchCheckbox(cbn) {
	return $d(cbn) && $d(cbn).checked == true ? 1 : 0;
};
function setcopy_gettext() {
	window.document.clipboardswf.SetVariable('str', clipboardswfdata)
};

function isUndefined(variable) {
	return typeof variable == 'undefined' ? true : false;
};

function mb_strlen(str) {
	var len = 0;
	for(var i = 0; i < str.length; i++) {
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == 'utf-8' ? 3 : 2) : 1;
	}
	return len;
};

function TurnCheckMenu(event,node,len){
	if($(event).attr("class") != "menuselected"){
		$(event).parents(".menu").find(".menuselected").removeClass("menuselected");
		$(event).addClass("menuselected");
		for(var i = 0; i < len; i++)
		{
			$("#"+node+"menulink" + i).hide();
		}
		$("#"+node+"menulink"+$(event).attr("tid")).show();
	}
};

function mb_cutstr(str, maxlen, dot) {
	var len = 0;
	var ret = '';
	var dot = !dot ? '...' : '';
	maxlen = maxlen - dot.length;
	for(var i = 0; i < str.length; i++) {
		len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == 'utf-8' ? 3 : 2) : 1;
		if(len > maxlen) {
			ret += dot;
			break;
		}
		ret += str.substr(i, 1);
	};
	return ret;
};

function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime() + seconds * 1000);
	domain = !domain ? cookiedomain : domain;	
	path = !path ? cookiepath : path;
	document.cookie = escape(cookieName) + '=' + escape(cookieValue)
		+ (expires ? '; expires=' + expires.toGMTString() : '')
		+ (path ? '; path=' + path : '/')
		+ (domain ? '; domain=' + domain : '')
		+ (secure ? '; secure' : '');
};
function getcookie(name) {
	var cookie_start = document.cookie.indexOf(name);
	var cookie_end = document.cookie.indexOf(";", cookie_start);
	return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
};
function strlen(str) {
	return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
};

function updatestring(str1, str2, clear) {
	str2 = '_' + str2 + '_';
	return clear ? str1.replace(str2, '') : (str1.indexOf(str2) == -1 ? str1 + str2 : str1);
};
function trim(str) {
	return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, '');
}

function _attachEvent(obj, evt, func, eventobj) {
	eventobj = !eventobj ? obj : eventobj;
	if(obj.addEventListener) {
		obj.addEventListener(evt, func, false);
	} else if(eventobj.attachEvent) {
		obj.attachEvent("on" + evt, func);
	}
};
var jsmenu = new Array();
var ctrlobjclassName="";
jsmenu['active'] = new Array();
jsmenu['timer'] = new Array();
jsmenu['iframe'] = new Array();
var InFloat = '';

function initCtrl(ctrlobj, click, duration, timeout, layer) {
	if(ctrlobj && !ctrlobj.initialized) {
		ctrlobj.initialized = true;
		ctrlobj.unselectable = true;

		ctrlobj.outfunc = typeof ctrlobj.onmouseout == 'function' ? ctrlobj.onmouseout : null;
		ctrlobj.onmouseout = function() {
			if(this.outfunc) this.outfunc();
			if(duration < 3 && !jsmenu['timer'][ctrlobj.id]) jsmenu['timer'][ctrlobj.id] = setTimeout('hideMenu(' + layer + ')', timeout);
		}

		ctrlobj.overfunc = typeof ctrlobj.onmouseover == 'function' ? ctrlobj.onmouseover : null;
		ctrlobj.onmouseover = function(e) {
			doane(e);
			if(this.overfunc) this.overfunc();
			if(click) {
				clearTimeout(jsmenu['timer'][this.id]);
				jsmenu['timer'][this.id] = null;
			} else {
				for(var id in jsmenu['timer']) {
					if(jsmenu['timer'][id]) {
						clearTimeout(jsmenu['timer'][id]);
						jsmenu['timer'][id] = null;
					}
				}
			}
		}
	}
};
function initMenu(ctrlid, menuobj, duration, timeout, layer, drag) {
	if(menuobj && !menuobj.initialized) {
		menuobj.initialized = true;
		menuobj.ctrlkey = ctrlid;
		menuobj.onclick = ebygum;
		menuobj.style.position = 'absolute';
		if(duration < 3) {
			if(duration > 1) {
				menuobj.onmouseover = function() {
					clearTimeout(jsmenu['timer'][ctrlid]);
					jsmenu['timer'][ctrlid] = null;
				}
			}
			if(duration != 1) {
				menuobj.onmouseout = function() {
					jsmenu['timer'][ctrlid] = setTimeout('hideMenu(' + layer + ')', timeout);
				}
			}
		}
		menuobj.style.zIndex = 999 + layer;
		if (ctrlid.indexOf("calendarexp") != -1)
		    menuobj.style.zIndex = 10003;
		if(drag) {
			menuobj.onmousedown = function(event) {try{menudrag(menuobj, event, 1);}catch(e){}};
			menuobj.onmousemove = function(event) {try{menudrag(menuobj, event, 2);}catch(e){}};
			menuobj.onmouseup = function(event) {try{menudrag(menuobj, event, 3);}catch(e){}};
		}
	}
};

var menudragstart = new Array();
function menudrag(menuobj, e, op) {
	if(op == 1) {
		if(in_array(is_ie ? event.srcElement.tagName : e.target.tagName, ['TEXTAREA', 'INPUT', 'BUTTON', 'SELECT'])) {
			return;
		}
		menudragstart = is_ie ? [event.clientX, event.clientY] : [e.clientX, e.clientY];
		menudragstart[2] = parseInt(menuobj.style.left);
		menudragstart[3] = parseInt(menuobj.style.top);
		doane(e);
	} else if(op == 2 && menudragstart[0]) {
		var menudragnow = is_ie ? [event.clientX, event.clientY] : [e.clientX, e.clientY];
		menuobj.style.left = (menudragstart[2] + menudragnow[0] - menudragstart[0]) + 'px';
		menuobj.style.top = (menudragstart[3] + menudragnow[1] - menudragstart[1]) + 'px';
		doane(e);
	} else if(op == 3) {
		menudragstart = [];
		doane(e);
	}
};
function hideMenu(layer) {
	if(isUndefined(layer)) layer = 0;
	if(jsmenu['active'][layer]) {
		try {
			$d(jsmenu['active'][layer].ctrlkey).className = ctrlobjclassName;
		} catch(e) {}
		clearTimeout(jsmenu['timer'][jsmenu['active'][layer].ctrlkey]);
		jsmenu['active'][layer].style.display = 'none';
		if(is_ie && is_ie < 7 && jsmenu['iframe'][layer]) {
			jsmenu['iframe'][layer].style.display = 'none';
		}
		jsmenu['active'][layer] = null;
	}
};
function fetchOffset(obj) {
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	while((obj = obj.offsetParent) != null) {
		left_offset += obj.offsetLeft;
		top_offset += obj.offsetTop;
	}
	return { 'left' : left_offset, 'top' : top_offset };
}

function ebygum(eventobj) {
	if(!eventobj || is_ie) {
		window.event.cancelBubble = true;
		return window.event;
	} else {
		if(eventobj.target.type == 'submit') {
			eventobj.target.form.submit();
		}
		eventobj.stopPropagation();
		return eventobj;
	}
}
function showMenu(ctrlid, click, showid, maxh, offset, duration, timeout, layer, drag) {
	var ctrlobj = $d(ctrlid);
	if(!ctrlobj) return;	
	if(isUndefined(click)) click = false;
	if(isUndefined(offset)) offset = 0;
	if(isUndefined(duration)) duration = 2;
	if(isUndefined(timeout)) timeout = 250;
	if(isUndefined(layer)) layer = 0;
	if(isUndefined(showid)) showid = ctrlid;
	var showobj = $d(showid);
	var menuobj = $d(showid + '_menu');
	if(!showobj || !menuobj) return;	
	if(isUndefined(maxh)) maxh = 400;
	if(isUndefined(drag)) drag = false;	
	if(click && jsmenu['active'][layer] == menuobj) {
		hideMenu(layer);
		return;
	} else {
		hideMenu(layer);
	}
	
	var len = jsmenu['timer'].length;
	if(len > 0) {
		for(var i=0; i<len; i++) {
			if(jsmenu['timer'][i]) clearTimeout(jsmenu['timer'][i]);
		}
	}

	initCtrl(ctrlobj, click, duration, timeout, layer);
	ctrlobjclassName = ctrlobj.className;
	ctrlobj.className += ' hover';
	initMenu(ctrlid, menuobj, duration, timeout, layer, drag);

	menuobj.style.display = 'block';
	if(!is_opera) {
		menuobj.style.clip = 'rect(auto, auto, auto, auto)';
	}

	setMenuPosition(showid, offset);
	if(maxh && menuobj.scrollHeight > maxh) {
		menuobj.style.height = maxh + 'px';
		if(is_opera) {
			menuobj.style.overflow = 'auto';
		} else {
			menuobj.style.overflowY = 'auto';
		}
	}	
	if(!duration) {
		setTimeout('hideMenu(' + layer + ')', timeout);
	}

	jsmenu['active'][layer] = menuobj;
};
function showMenu2(ctrlid, click, offset, duration, timeout, layer, showid, maxh, drag) {
	showMenu(ctrlid, click, showid, maxh, offset, duration, timeout, layer, drag);
};
function setMenuPosition(showid, offset) {
	var showobj = $d(showid);
	var menuobj = $d(showid + '_menu');
	if(isUndefined(offset)) offset = 0;
	if(showobj) {
		showobj.pos = fetchOffset(showobj);
		showobj.X = showobj.pos['left'];
		showobj.Y = showobj.pos['top'];		
		if($d(InFloat) != null) {
			var InFloate = InFloat.split('_');
			if(!floatwinhandle[InFloate[1] + '_1']) {
				floatwinnojspos = fetchOffset($d('floatwinnojs'));
				floatwinhandle[InFloate[1] + '_1'] = floatwinnojspos['left'];
				floatwinhandle[InFloate[1] + '_2'] = floatwinnojspos['top'];
			}
			showobj.X = showobj.X - $d(InFloat).scrollLeft - parseInt(floatwinhandle[InFloate[1] + '_1']);
			showobj.Y = showobj.Y - $d(InFloat).scrollTop - parseInt(floatwinhandle[InFloate[1] + '_2']);
			InFloat = '';
		}		
		showobj.w = showobj.offsetWidth;
		showobj.h = showobj.offsetHeight;
		menuobj.w = menuobj.offsetWidth;
		menuobj.h = menuobj.offsetHeight;
		if(offset < 3) {
			menuobj.style.left = (showobj.X + menuobj.w > document.body.clientWidth) && (showobj.X + showobj.w - menuobj.w >= 0) ? showobj.X + showobj.w - menuobj.w + 'px' : showobj.X + 'px';
			menuobj.style.top = offset == 1 ? showobj.Y + 'px' : (offset == 2 || ((showobj.Y + showobj.h + menuobj.h > document.documentElement.scrollTop + document.documentElement.clientHeight) && (showobj.Y - menuobj.h >= 0)) ? (showobj.Y - menuobj.h) + 'px' : showobj.Y + showobj.h + 'px');
		} else if(offset == 3) {
			menuobj.style.left = (document.body.clientWidth - menuobj.clientWidth) / 2 + document.body.scrollLeft + 'px';
			menuobj.style.top = (document.body.clientHeight - menuobj.clientHeight) / 2 + document.body.scrollTop + 'px';
		}

		if(menuobj.style.clip && !is_opera) {
			menuobj.style.clip = 'rect(auto, auto, auto, auto)';
		}
		
	}
};
function fetchOffset(obj) {
	var left_offset = obj.offsetLeft;
	var top_offset = obj.offsetTop;
	while((obj = obj.offsetParent) != null) {
		left_offset += obj.offsetLeft;
		top_offset += obj.offsetTop;
	}
	return { 'left' : left_offset, 'top' : top_offset };
};
function doMenu(MSort,MCount,MName,MFrame){
 if(isUndefined(MFrame)) MFrame = "DivShimFrame";
 if(isUndefined(MSort)) MSort = 1;
 if(isUndefined(MCount)) MCount = 1;
 if(isUndefined(MName)) MName = "swin";
 var IfrRef = $d(MFrame);
 for (var i=1; i<=parseInt(MCount); i++){
  if (MSort == i) {
   if($d(MName+i).style.display == "block"){
    $d(MName+i).style.display = "none";
	IfrRef.style.display = "none";
   }else{
    $d(MName+i).style.display = "block";
	IfrRef.style.width = $d(MName+i).offsetWidth;
    IfrRef.style.height = $d(MName+i).offsetHeight;
    IfrRef.style.top = $d(MName+i).style.top;
    IfrRef.style.left = $d(MName+i).style.left;
    IfrRef.style.zIndex = $d(MName+i).style.zIndex - 1;
    IfrRef.style.display = "block";

   }
  }else{
   $d(MName+i).style.display = "none";
  }
 }
};
function doMenuMiddle(MSort,MCount,MName,MFrame){
 if(isUndefined(MFrame)) MFrame = "DivShimFrame";
 if(isUndefined(MSort)) MSort = 1;
 if(isUndefined(MCount)) MCount = 1;
 if(isUndefined(MName)) MName = "swin";
 var IfrRef = $d(MFrame);
 var sClientWidth = parent ? parent.document.body.offsetWidth : document.body.offsetWidth;
 var sClientHeight = parent ? parent.document.body.offsetHeight : document.body.offsetHeight;
 var sScrollTop = parent ? (parent.document.body.scrollTop+parent.document.documentElement.scrollTop) : (document.body.scrollTop+document.documentElement.scrollTop);	
 for (var i=1; i<=parseInt(MCount); i++){
  if (MSort == i) {
   if($d(MName+i).style.display == "block"){
    $d(MName+i).style.display = "none";
	IfrRef.style.display = "none";
   }else{
    $d(MName+i).style.display = "block";
	$d("loginBox1")['style']['margin'] = "0 auto";
 	$d(MFrame)['style']['opacity']	= "0.2";
 	$d(MFrame)['style']['filter'] = "alpha(opacity=20)";
 	$d(MName+i)['style']['position'] = "absolute";
 	var sleft = (sClientWidth) / 2;
	var iTop = sScrollTop + sClientHeight + 80;	
	var sTop = iTop > 0 ? iTop : 0;
	$d(MName+i)['style']['left'] = sleft - ($d(MName+i).offsetWidth / 2) + "px";
	$d(MName+i)['style']['top'] = (sTop - $d(MName+i).offsetHeight) / 2 + "px";
	IfrRef.style.width = $d(MName+i).offsetWidth;
    IfrRef.style.height = $d(MName+i).offsetHeight;
    IfrRef.style.top = $d(MName+i).style.top;
    IfrRef.style.left = $d(MName+i).style.left;
    IfrRef.style.zIndex = $d(MName+i).style.zIndex - 1;
    IfrRef.style.display = "block";

   }
  }else{
   $d(MName+i).style.display = "none";
  }
 }
};
function read_radio(rname){
	return $("input[name='"+rname+"'][@checked]").val()
};

function read_checkbox(rname){
	var str=''
	var temp=document.getElementsByName(rname);
	for (i=0;i<temp.length;i++){
    if(temp[i].checked){
      if (str==''){str=temp[i].value}else{str=str+','+temp[i].value}
      }
 	}
	return str;
};
function checkPositiveInt(iv)
{
	var a = /^(\d*|\-?[1-9]{1}\d*)$/;
    if(!iv.match(a)){ return false; }else{ return true;};
};
function URLencode(sStr)
{
    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/\//g,'%2F');
};
function del_space(s)
{
    if (s==undefined) return '';
	for(i=0;i<s.length;++i)
	{
	 if(s.charAt(i)!=" ")
		break;
	}
	for(j=s.length-1;j>=i;--j)
	{
	 if(s.charAt(j)!=" ")
		break;
	}
	return s.substring(i,++j);
};
function chkdiv(divid){
	return $d(divid);
};
function chkobj(id){
	return $d(id)!=null?true:false;
};
function changeStringToXml(response)
{
    if (response==null||typeof(response) == "object"){return response;};
    var xmlDoc;
    // Mozilla and Netscape browsers
    if (document.implementation.createDocument) {
        var parser = new DOMParser();
        xmlDoc = parser.parseFromString(response, "application/xml");
    // MSIE
    } else if (window.ActiveXObject) {
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async="false";
        xmlDoc.loadXML(response);
    }
    return xmlDoc;
};
function hasClass(clsName,elem)
{
	var str = elem.className;
	var re = new RegExp('(?:^|\\s+)' + clsName + '(?:\\s+|$)') ;
	return re.test(str) ? true : false ;
};
function addClass(clsName,elem)
{
	if (!hasClass(clsName,elem))
	{
		elem['className'] = [elem['className'], clsName].join(' ');
	}
};
function removeClass(clsName,elem)
{
	var re = new RegExp('(?:^|\\s+)' + clsName + '(?:\\s+|$)', 'g');
	if (!this.hasClass(clsName,elem)) { return; } ;
	elem['className'] = elem['className'].replace(re, ' ');
	if ( this.hasClass(clsName,elem) )
	{
		this.removeClass(clsName,elem);
	}
};
function isUnsignedNumeric(strNumber) {
    var newPar=/^\d+(\.\d+)?$/
    return (newPar.test(strNumber));
};
function ShowFormatBytesStr(bytes) {
	if(bytes > 1073741824) {
		document.write((Math.round((bytes/1073741824)*100)/100).toString()+' G');
	} else if(bytes > 1048576) {
		document.write((Math.round((bytes/1048576)*100)/100).toString()+' M');
	} else if(bytes > 1024) {
		document.write((Math.round((bytes/1024)*100)/100).toString()+' K');
	} else {
		document.write(bytes.toString()+' Bytes');
	}
};
function GetBodyOffset()
{
	var servicetopOffset =(document.body.clientWidth>document.documentElement.clientWidth ? document.body.clientWidth:document.documentElement.clientWidth);
	var servicetopMiddle = (document.body.scrollTop>document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+(document.body.clientHeight>document.documentElement.clientHeight ? document.body.clientHeight:document.documentElement.clientHeight);
	return { 'width' : servicetopOffset, 'height' : servicetopMiddle };
};
function setObjRight(objid)
{
	var servicetopCenter =(document.body.clientWidth>document.documentElement.clientWidth ? document.body.clientWidth:document.documentElement.clientWidth)-$d(objid).offsetWidth;
	if(!$.browser.msie)
	{
		servicetopCenter=servicetopCenter-42;
	}	
	$d(objid).style.left=servicetopCenter+"px";

};
function setObjCenter(objid)
{
	var servicetopRight =(document.body.clientWidth>document.documentElement.clientWidth ? document.body.clientWidth:document.documentElement.clientWidth)-$d(objid).offsetWidth;
	$d(objid).style.left=servicetopRight / 2 + "px";
	alert($d(objid).style.left);
};
function setObjBottom(objid)
{
	var servicetopHeight = (document.body.scrollTop>document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+(document.body.clientHeight>document.documentElement.clientHeight ? document.body.clientHeight:document.documentElement.clientHeight)-$d(objid).offsetHeight;
	$d(objid).style.top=servicetopHeight+"px";
};
function setObjMiddle(objid)
{
	var servicetopMiddle = (document.body.scrollTop>document.documentElement.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+(document.body.clientHeight>document.documentElement.clientHeight ? document.body.clientHeight:document.documentElement.clientHeight)-$d(objid).offsetHeight;
	$d(objid).style.top=servicetopMiddle / 2 +"px";
};
function newfunction(func){
	var args = new Array();
	for(var i=1; i<arguments.length; i++) args.push(arguments[i]);
	return function(event){
		doane(event);
		window[func].apply(window, args);
		return false;
	}
};
function in_array(needle, haystack) {
	if(typeof needle == 'string' || typeof needle == 'number') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
					return true;
			}
		}
	};
	return false;
};
var STYLEID = '1';
var VERHASH = 'Pvt';
var cssloaded= new Array();
function loadcss(cssname) {

	if(!cssloaded[cssname]) {
		var css = document.createElement('link');
		css.type = 'text/css';
		css.rel = 'stylesheet';
		css.href = 'cssdata/cache/style_' + STYLEID + '_' + cssname + '.css?' + VERHASH;
		var headNode = document.getElementsByTagName("head")[0];
		headNode.appendChild(css);
		cssloaded[cssname] = 1;
	}
};
var evalscripts = new Array();
function evalscript(s) {
	if(s.indexOf('<script') == -1) return s;
	var p = /<script[^\>]*?>([^\x00]*?)<\/script>/ig;
	var arr = new Array();
	while(arr = p.exec(s)) {
		var p1 = /<script[^\>]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/i;
		var arr1 = new Array();
		arr1 = p1.exec(arr[0]);
		if(arr1) {
			appendscript(arr1[1], '', arr1[2], arr1[3]);
		} else {
			p1 = /<script(.*?)>([^\x00]+?)<\/script>/i;
			arr1 = p1.exec(arr[0]);
			appendscript('', arr1[2], arr1[1].indexOf('reload=') != -1);
		}
	}
	return s;
};

function getRequestBody(oForm) {
	var aParams = new Array();
	for (var i=0 ; i < oForm.elements.length; i++) {
		/*
		if (oForm.elements[i].type == "checkbox" && oForm.elements[i].checked == false)
		{
			continue;
		}
		*/
		var sParam = encodeURIComponent(oForm.elements[i].name);
		sParam += "=";
		sParam += encodeURIComponent(oForm.elements[i].value);
		aParams.push(sParam);
	}
	return aParams.join("&");
};

function getSpecificNodeValue(doc, tagname, index)
{
	try{
		var oNodes = doc.getElementsByTagName(tagname);
		if (oNodes[index] != null && oNodes[index] != undefined)
		{
			if (oNodes[index].childNodes.length > 1) {
				return oNodes[index].childNodes[1].nodeValue;
			} else {
				return oNodes[index].firstChild.nodeValue;    		
			}
		}
	}
	catch(e){}
	return '';
};

function getSingleNodeValue(doc, tagname)
{
	try{
		var oNodes = doc.getElementsByTagName(tagname);
		if (oNodes[0] != null && oNodes[0] != undefined)
		{
			if (oNodes[0].childNodes.length > 1) {
				return oNodes[0].childNodes[1].nodeValue;
			} else {
				return oNodes[0].firstChild.nodeValue;    		
			}
		}
	}
	catch(e){}
	return '';
};
function appendscript(src, text, reload) {
	var id = hash(src + text);
	if(!reload && in_array(id, evalscripts)) return;
	if(reload && $d(id)) {
		$d(id).parentNode.removeChild($d(id));

	}
	evalscripts.push(id);
	var scriptNode = document.createElement("script");
	scriptNode.type = "text/javascript";
	scriptNode.id = id;
	try {
		if(src) {
			scriptNode.src = src;
		} else if(text){
			scriptNode.text = text;
		}
		$d('append_parent').appendChild(scriptNode);		

	} catch(e) {}

};
function hash(string, length) {
	var length = length ? length : 32;
	var start = 0;
	var i = 0;
	var result = '';
	filllen = length - string.length % length;
	for(i = 0; i < filllen; i++){
		string += "0";
	};

	while(start < string.length) {
		result = stringxor(result, string.substr(start, length));
		start += length;
	}
	return result;
};

function stringxor(s1, s2) {
	var s = '';
	var hash = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var max = Math.max(s1.length, s2.length);
	for(var i=0; i<max; i++) {
		var k = s1.charCodeAt(i) ^ s2.charCodeAt(i);
		s += hash.charAt(k % 52);
	}
	return s;
};
function getQueryString(queryname) {
    var qKeys = {};
    var re = /[?&]([^=]+)(?:=([^&]*))?/g;
    var matchInfo;
    while(matchInfo = re.exec(location.search)){
	    qKeys[matchInfo[1]] = matchInfo[2];
    }
    return typeof(qKeys[queryname])=='undefined'?'':qKeys[queryname];
};
function findtags(parentobj, tag) {
	if(!isUndefined(parentobj.getElementsByTagName)) {
		return parentobj.getElementsByTagName(tag);
	} else if(parentobj.all && parentobj.all.tags) {
		return parentobj.all.tags(tag);
	} else {
		return null;
	}
};

//PageScroll
function pagescroll_class(obj, pagewidth, pageheight) {
	this.ctrlobj = $d(obj);	
	this.speed = 2;
	this.pagewidth = pagewidth;
	this.times = 1;
	this.pageheight = pageheight;
	this.running = 0;
	this.defaultleft = 0;
	this.defaulttop = 0;
	this.script = '';
	this.start = function(times) {
		if(this.running) return 0;
		this.times = !times ? 1 : times;
		this.scrollpx = 0;
		return this.running = 1;
	}
	this.left = function(times, script) {
		if(!this.start(times)) return;
		this.stepv = -(this.step = this.pagewidth * this.times / this.speed);
		this.script = !script ? '' : script;
		setTimeout('pagescroll.h()', 1);
	}
	this.right = function(times, script) {
		if(!this.start(times)) return;
		this.stepv = this.step = this.pagewidth * this.times / this.speed;
		this.script = !script ? '' : script;
		setTimeout('pagescroll.h()', 1);
	}
	this.up = function(times, script) {
		if(!this.start(times)) return;
		this.stepv = -(this.step = this.pageheight * this.times / this.speed);
		this.script = !script ? '' : script;
		setTimeout('pagescroll.v()', 1);
	}
	this.down = function(times, script) {
		if(!this.start(times)) return;
		this.stepv = this.step = this.pageheight * this.times / this.speed;
		this.script = !script ? '' : script;
		setTimeout('pagescroll.v()', 1);
	}
	this.h = function() {
		if(this.scrollpx <= this.pagewidth * this.times) {
			this.scrollpx += Math.abs(this.stepv);
			patch = this.scrollpx > this.pagewidth * this.times ? this.scrollpx - this.pagewidth * this.times : 0;
			patch = patch > 0 && this.stepv < 0 ? -patch : patch;
			oldscrollLeft = this.ctrlobj.scrollLeft;
			this.ctrlobj.scrollLeft = this.ctrlobj.scrollLeft + this.stepv - patch;
			if(oldscrollLeft != this.ctrlobj.scrollLeft) {
				setTimeout('pagescroll.h()', 1);
				return;
			}
		}
		if(this.script) {
			eval(this.script);
		}
		this.running = 0;
	}
	this.v = function() {
		if(this.scrollpx <= this.pageheight * this.times) {
			this.scrollpx += Math.abs(this.stepv);
			patch = this.scrollpx > this.pageheight * this.times ? this.scrollpx - this.pageheight * this.times : 0;
			patch = patch > 0 && this.stepv < 0 ? -patch : patch;
			oldscrollTop = this.ctrlobj.scrollTop;
			this.ctrlobj.scrollTop = this.ctrlobj.scrollTop + this.stepv - patch;
			if(oldscrollTop != this.ctrlobj.scrollTop) {
				setTimeout('pagescroll.v()', 1);
				return;
			}
		}
		if(this.script) {
			eval(this.script);
		}
		this.running = 0;
	}
	this.init = function() {
		this.ctrlobj.scrollLeft = this.defaultleft;
		this.ctrlobj.scrollTop = this.defaulttop;
	}

};
function rsimg(o,w)
{
	if(o.width>w){
		o.resized=true;
		//o.width=w;
		o.style.width="100%";
		//o.height=(w/o.width)*o.height;
	}
};
var cookiedomain = isUndefined(cookiedomain) ? '' : cookiedomain;
var cookiepath = isUndefined(cookiepath) ? '' : cookiepath;
