// JavaScript DocumentEvent.observe(window, 'load', set_image_rollover, false);Event.observe(window, 'load', set_input_rollover, false);Event.observe(window, 'load', set_editable_fields, false);Event.observe(window, 'load', set_input_accept, false);Event.observe(window, 'load', set_price_fields, false);Event.observe(window, 'load', set_input_defaults, false);function set_image_rollover(){ images = document.getElementsByTagName("img");for(i=0;i<images.length;i++){ if(images[i].getAttribute("rollover")!=null){ pre_img = new Image(); pre_img.src = images[i].getAttribute("rollover"); pre_img = null; images[i].setAttribute('origional', images[i].src); images[i].onmouseover = function(){ this.src=this.getAttribute('rollover');}; images[i].onmouseout = function(){ this.src=this.getAttribute('origional');};}}}function set_input_rollover(){ images = document.getElementsByTagName("input");for(i=0;i<images.length;i++){ if(images[i].getAttribute("rollover")!=null){ pre_img = new Image(); pre_img.src = images[i].getAttribute("rollover"); pre_img = null; images[i].setAttribute('origional', images[i].src); images[i].onmouseover = function(){ this.src=this.getAttribute('rollover');}; images[i].onmouseout = function(){ this.src=this.getAttribute('origional');};}}}function set_input_accept(){ images = document.getElementsByTagName("input");for(i=0;i<images.length;i++){ if(images[i].getAttribute("type")=="text"&&images[i].getAttribute("accept")!=null){ images[i].onkeypress = function(e){ key = get_key(e); if(this.getAttribute('accept').indexOf(key)>=0) return true; return false;};}}}function set_editable_fields(){ 		elements = document.getElementsByTagName("*");	for(i=0;i<elements.length;i++){		if(isset(elements[i].getAttribute("editable"))){			elements[i].setAttribute("editable-origional-style-background", elements[i].style.background);			elements[i].setAttribute("editable-origional-style-border", elements[i].style.border);			elements[i].style.cursor="pointer";			elements[i].onmouseover=function(){this.style.background="#CCCCCC";/*this.style.border="1px solid black";*/}			elements[i].onmouseout=function(){this.style.background=this.getAttribute("editable-origional-style-background");/*this.style.border=this.getAttribute("editable-origional-style-border");*/}			elements[i].onmousedown=function(){ 				extra=""; 				page=window.location.href.split("\?").shift();				if(isset(this.getAttribute('editable_extra'))) extra="&"+this.getAttribute('editable_extra'); 				if(isset(this.getAttribute('editable_page'))) page=this.getAttribute('editable_page'); 				redirect(page+"?edit-field="+this.getAttribute("editable")+extra);			}			//window.alert(elements[i].getAttribute("editable"));		}	}}function set_input_defaults(){ 		elements = document.getElementsByTagName("input");	for(i=0;i<elements.length;i++){		if(isset(elements[i].getAttribute("default"))&&elements[i].getAttribute("type").toLowerCase()=="text"){			if(isset(elements[i].style.color)) elements[i].setAttribute("oldcolor", elements[i].style.color);			elements[i].style.color="#CCCCCC";			elements[i].value=elements[i].getAttribute("default");			elements[i].onfocus=function(){ if((this.style.color.toUpperCase()=="#CCCCCC"||this.style.color.toRGBHex()=="CCCCCC")&&this.value==this.getAttribute("default")){ this.value=""; if(isset(this.getAttribute("oldcolor"))) this.style.color=this.getAttribute("oldcolor"); else this.style.color="";}}			elements[i].onblur =function(){ if(this.value==""){ this.value=this.getAttribute("default"); this.style.color="#CCCCCC";}}		}	}}function set_price_fields(){ 		elements = document.getElementsByTagName("input");	for(i=0;i<elements.length;i++){		if(isset(elements[i].getAttribute("price"))){			elements[i].onkeypress=function(oEvent){				var code;				if (!oEvent) var oEvent = window.event;				if (oEvent.keyCode) code = oEvent.keyCode;				else if (oEvent.which) code = oEvent.which;				if(code=="9"||code=="8"||code=="116") return true;				var character = String.fromCharCode(code);								if("0123456789".indexOf(character)>=0) return true;				else if(character=="."&&this.value.indexOf(".")==-1) return true;				return false;			}		}	}}function isset(VALUE){	return !(VALUE==null);	}function redirect(URL){	window.location.href=URL;}function get_key(e){	if(window.event){		keynum = e.keyCode;	}else if(e.which){		keynum = e.which;	}	return(String.fromCharCode(keynum));}function gen_string(length){		return("aser92A");}String.prototype.trim = function() {	return this.replace(/^\s+|\s+$/g,"");}String.prototype.ltrim = function() {	return this.replace(/^\s+/,"");}String.prototype.rtrim = function() {	return this.replace(/\s+$/,"");}String.prototype.RGBToHex = function() {	var char = "0123456789ABCDEF";	return String(char.charAt(Math.floor(this / 16))) + String(char.charAt(this - (Math.floor(this / 16) * 16)));} function RGB2HTML(red, green, blue){    var decColor = red + 256 * green + 65536 * blue;    return decColor.toString(16);}String.prototype.toRGBHex = function(){	var numStr = this.toLowerCase().replace("rgb", "").replace("(", "").replace(")", "");	var decToHex="";	var arr = new Array();		arr = numStr.split(",");	var hexArray = new Array( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" );	for(var i=0;i<3;i++)	{		var code1 = Math.floor(arr[i] / 16);		var code2 = arr[i] - code1 * 16;			decToHex += hexArray[code1];		decToHex += hexArray[code2];	}	return (decToHex);}function Ajax(){	var xmlHttp=null;	try{		// Firefox, Opera 8.0+, Safari		xmlHttp=new XMLHttpRequest();	}catch (e){		// Internet Explorer		try{			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");		}catch (e){			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		}	}	return xmlHttp;}