var allPopups = new Array();
var bullets = new Array();

var SCROLL_TOP = 1; /*@c */
var SCROLL_LEFT = 2; /*@c */
var tttimer = null;
var i_isIE = null; /*# true if is Internet Explorer, else null */
var i_isFF = null; /*# true if is Firefox, else null */
var i_isSF = null;/*#  true if  is Safari, else null */
var i_isGC = null; /*# true if is Google Chrome , else null */
var i_isOP = null; /*# true if is Opera , else null */
var is_win = null;
var is_mac = null;

var PERMISION_DENIED = 403;
var PAGE_NOT_FOUND = 404;


i_detectBrowser();

var cart_default_left = -1;
var cart_default_top = -1;
var cart_out = false;
var cart_default_parent = null;



function i_detectBrowser(){
	if (navigator.appName == "Microsoft Internet Explorer"){
			i_isIE = true;
	}else{
		var ua = navigator.userAgent.toLowerCase();
		if (ua.indexOf("chrome")>-1) i_isGC = true;
		else if (ua.indexOf("safari")>-1) i_isSF = true;
		else if (ua.indexOf("firefox")>-1) i_isFF = true;
		else if (ua.indexOf("opera")>-1) i_isOP = true;
	}

	var np = navigator.platform.toLowerCase();
	if (np.indexOf("win")>-1) is_win = true;
	if (np.indexOf("mac")>-1) is_mac = true;
	{
	}
}


var i_curYear = parseInt(new Date().getYear());
if (!i_isIE) i_curYear = 1900+i_curYear;

window.onload = function(evt){
//	_fc.onscroll(evt);
	redoShoppingCart();
	
	try{
		window_onload();
	}catch(e){
	}
}





window.onresize = function(evt){
	if (i_isIE) evt = event;
	i_hidePopups();
	try{
		window_onresize(evt);
	}catch(e){
		
	}
}


i_mouse_x = null;
i_mouse_y = null;
i_tooltip_gtc = null;
var i_currentTTContainer = null;
var i_currentX = -1;
var i_currentY = -1;
var i_objectX =-1;
var i_objectY = -1;
var i_currentObject = null;

document.onmousedown1 = function(evt){
	if (!evt) evt = event;

		if (i_isIE){
				i_currentX = evt.clientX;
				i_currentY = evt.clientY;
		}else{
				i_currentX = evt.pageX;
				i_currentY = evt.pageY;
		}

		var targ = null;
		if (evt.target) targ = evt.target;
		else if (evt.srcElement) targ = evt.srcElement;
		i_currentObject = targ;
}

document.onmousemove = function(evt){
		
		if (i_isIE) evt = event;
		
		var mx = evt.pageX;
		var my = evt.pageY;
		if (i_isIE){
				mx = evt.clientX;
				my = evt.clientY;
		}
		i_mouse_x = parseFloat(mx);
		i_mouse_y = parseFloat(my)+i_getDocScroll(SCROLL_TOP);
		
		if (i_currentTTContainer != null){			
			if (!i_mouseIsInside(i_currentTTContainer)){
				
				//i_hideToolTip();
			}
		}

		//moving the dialogs
		if (i_currentObject != null){
				if (i_objectY < 40){
					var x = mx-i_objectX;
					var y = my-i_objectY;
					i_currentObject.style.left = x+"px";
					i_currentObject.style.top = y+"px";
				}
		}
}

document.onmouseup =  function(evt){
	if (i_isIE) evt = event;
	i_currentObject = null;
	window.setTimeout("_checkForTT()",20);

	if (window.location.href.toString().endsWith("/domain/list") || window.location.href.toString().endsWith("/domainlist")){
		if (currentTag == null) return;
		var tbl = i_get("main_tableajax");
		var left = i_getLeft(tbl);
		var top = i_getTop(tbl);
		var width = left+parseInt(tbl.offsetWidth);
		var height = top+parseInt(tbl.offsetHeight);
		var x = evt.pageX;
		var y = evt.pageY;
		if ( (x < left || y < top) || (x > width || y > height)){
			//I need to hide open tags if pressent
				currentTag.parentNode._tdone = false;
			putTags(currentTag);
		}
	}
}




function _checkForTT(){
	if (i_currentTTContainer != null){
			if (!i_isDisplayable(i_currentTTContainer._parent)){
				i_hideToolTip();
			}
		}

}


 document.onmousedown = function(evt){
		if (i_isIE) evt = event;
		
		if (bullets.length > 0){
			i_clearBullets();
		}

		var mx = evt.pageX;
		var my = evt.pageY;
		if (i_isIE){
				
				mx = evt.clientX;
				my = evt.clientY+document.documentElement.scrollTop	;
				
		}

		i_currentX = mx;
		i_currentY = my;
		
	//	alert(i_currentX+":"+i_currentY+"\n"+evt.clientX+":"+evt.clientY+"\n"+evt.x+":"+evt.y);

		var targ = null;
		if (evt.target) targ = evt.target;
		else if (evt.srcElement) targ = evt.srcElement;
		
		if (i_getParent(targ,"dlg_") != null) {
				i_currentObject = i_getParent(targ,"dlg_");
				i_objectX = parseInt(i_currentX)-i_getLeft(i_currentObject);
				i_objectY = parseInt(i_currentY)-i_getTop(i_currentObject);
		}
		if (targ.id && targ.id == "big_tool_tip_moveable_bar"){
		//if (i_hasParent(targ,"big_tool_tip_moveable_bar")){
				i_currentObject = i_get("big_general_tooltip_container");
				i_objectX = parseInt(i_currentX)-i_getLeft(i_currentObject);
				i_objectY = parseInt(i_currentY)-i_getTop(i_currentObject);
		}
	
	

		for (var i=0;i<allPopups.length;i++ ){
						var mypopup = allPopups[i];

								if (mypopup.visible == true){
									if (i_isIE) {
										evt = event;
									
									}
									if (evt.clientX ==0 && evt.clientY ==0){ //for non IE browsers
									
										return;
									}

									var _left = parseInt(mypopup._pop.style.left);
									var _top = parseInt(mypopup._pop.style.top);
									var _width = parseInt(mypopup._pop.style.width);
									var _height = parseInt(mypopup._pop.style.height);
									if (mx > _left && my > _top && (mx < _left+_width) && (my < _top+_height) ){
										//is inside of the container
										//popup of the container
									}else{
										var targ = null;
										if (evt.target) targ = evt.target;
										else if (evt.srcElement) targ = evt.srcElement;
										
										if (targ.tagName == "SPAN"){
											targ = targ.parentNode;
										}
										if(mypopup.trigger ==  targ){
											
											i_currentObject = targ;
										}else{
											if (targ.tagName != "OPTION" && targ.tagName != "SELECT"){
												mypopup.hide();
											}
										}
									}
								}// if _newLoginD/visibility
								
					}
						
		try{
			document_onclick(evt);
		}catch(ex){
		
		}
}//document.onclick

function i_hidePopups(){ //#hide all open popups. It is made automatically. But if you want to use it 
	try {
			for (var i=0;i<allPopups.length;i++ ){
				var mypopup = allPopups[i];
				if (mypopup.visible) mypopup.hide();
			}
	}catch(e){}
}


function i_getLeft(_object){ //# get absolute left position of an object \\ Usage: i_getLeft(object) or i_getLeft(objectid);
	if (_object == null) {
		return -1;
	}
	if (typeof _object != "object") _object = document.getElementById(_object);
	var nLeft = 0;
	while (_object.offsetParent)
	{
		nLeft += _object.offsetLeft;
		_object = _object.offsetParent;
	}
	return nLeft;
}

function i_getTop(_object){ //# get absolute top position of an object \\ Usage: i_getTop(object) or i_getTop(objectid); 
	if (_object == null) {
		return -1;
	}
	if (typeof _object != "object") _object = document.getElementById(_object);
	var nTop = 0;
	var k =0;
	while (_object.offsetParent){
 		nTop += _object.offsetTop;
 		_object = _object.offsetParent;
		k++;
	}

 	return nTop;
	}

function i_isDisplayable(_object){
	if (typeof _object != "object") _object = i_get(_object);
	while (_object.parentNode){
			if (_object.style.display == "none"){
				return false;
			}
		_object = _object.parentNode;
	}
	return true;
}


function i_isVisible(_object){
	if (typeof _object != "object") _object = i_get(_object);
	while (_object.parentNode){
			if (_object.style.visibility == "hidden"){
				return false;
			}
		_object = _object.parentNode;
	}
	return true;
}

function i_isDisplay(_object){
	if (typeof _object != "object") _object = i_get(_object);
	while (_object.parentNode){
			if (_object.style.display == "none"){
				return false;
			}
		_object = _object.parentNode;
	}
	return true;
}


function i_replaceStr(Str,replaceStr,newStr) //# replace a string with another string from a string :))
{
	if (Str == null) return null;
	var fistSec = new Date();
          for (var ii=0;ii<Str.length ;ii++ )
          {
          if (Str.substring(ii,ii+replaceStr.length)==replaceStr)
          {
          Str=Str.substring(0,ii)+newStr+Str.substring(ii+replaceStr.length);
          }
          }
          return Str;
}

function i_clearSelection() { //# clears selections from document
var sel ;
if(document.selection && document.selection.empty){
document.selection.empty() ;
} else if(window.getSelection) {
sel=window.getSelection();
if(sel && sel.removeAllRanges)
sel.removeAllRanges() ;
}
}

function i_getParameter(param,url){ //# get a parameter from a URL . \\ Example : url: http://inwx.de/domain/list/#page = 2 \\ Usage: i_getParameter("page",url);
	var myvalue = null;
	url = i_replaceStr(url,"%23","#");
	if ( url.indexOf("#"+param)>-1 ) {
			myvalue = url.substring(url.indexOf("#"+param+"=")+param.length+2);
		  if (myvalue.indexOf("#")>-1) myvalue = myvalue.substring(0,myvalue.indexOf("#"));
	}

	return myvalue;
}

//window size

function i_getDocWidth(){ //# get document width. Only the visible (viewport) area, without scrolls)
	var fc = document.getElementById("full_container");
	return fc.offsetWidth;
}


function i_getDocHeight(){ //# get document height. Only the visibile (viewport) area, without the scrolls)
	var fc = document.getElementById("full_container");
	return fc.offsetHeight;
}

function i_getDocScroll(o){ //# get document scroll position (top / left). You must use it SCROLL_TOP or SCROLL_LEFT , constants. \\ example: i_getDocScroll(SCROLL_TOP)
	var fc = document.getElementById("full_container");
	if (fc == null) return -1;
	if (o == SCROLL_TOP){
		return parseInt(fc.scrollTop);
	}else{
		return parseInt(fc.scrollLeft);
	}
}

//create debugWindow

var _debug_w = document.createElement("DIV");
_debug_w.style.position = "absolute";_debug_w.style.backgroundColor = "yellow";
_debug_w.style.width = "200px";
_debug_w.style.height = "500px";
_debug_w.style.padding = "5px";
_debug_w.style.overflow = "auto";
_debug_w._visible = false;

 //showDebug();

function  showDebug(){

}


function showDebug1(){
	try{
	reposDebug ();
	_debug_w.style.border = "solid black 1px";
	_debug_w.style.zIndex = 9000;
	_debug_w._visible = true;
	document.body.appendChild(_debug_w);
	}catch(e){
		
		window.setTimeout("showDebug()",300);
	}
}

function reposDebug(){
	_debug_w.style.left = (i_getDocWidth()-230)+"px";
	_debug_w.style.top = "20px";
}


function _debug(str){

}

function _debug1(str){ 
	if (_debug_w._visible == false){
		showDebug();
	}

	_debug_w.innerHTML += str+"<br>";
	_debug_w.scrollTop = parseInt(_debug_w.scrollHeight)+100;
}

function _error(str){
	showDebug();
	_debug(str);
}

Array.prototype.add = function(val){
	var arr = this;
	this[this.length] = val;
}

Array.prototype.toHString = function(){
	var arr  = this;
	var str = "";
	for (var i=0;i<arr.length ;i++ )	{
			str += arr[i];
			if (i<arr.length-1) str += ", ";
	}
	return str;
}


Array.prototype.remove = function(val){
	var arr = this;
	var tarr = new Array();
	if (arr.contains(val)){
		for (var i = 0 ;i < arr.length ;i ++ ){
		if (arr[i] != val){
			tarr[tarr.length] = arr[i];
		}else{

		}
		}
	}
	arr = tarr;
	return tarr;
}

Array.prototype.contains = function(val){
	var arr = this;
	for (var ixx=0;ixx<arr.length ;ixx++ ){
		if (arr[ixx] == val) return true;
	}
	return false;
}

Array.prototype.unique = function () {
	var r = new Array();
	o:for(var i = 0, n = this.length; i < n; i++)
	{
		for(var x = 0, y = r.length; x < y; x++)
		{
			if(r[x]==this[i])
			{
				continue o;
			}
		}
		r[r.length] = this[i];
	}
	return r;
}

String.prototype.trim = function(){
	var val = this;
	while (val.substring(0,1) == " "){
			val = val.substring(1);
	}	
	while (val.substring(val.length-1,val.length) == " " ){
		val = val.substring(0,val.length-1);
	}	
	return val;
}

String.prototype.count = function(l){
	var k =0;
	var val = this;
	while (val.indexOf(l)>-1){
			k++;
			val = val.substring(val.indexOf(l)+l.length);
	}
	return k;
}

String.prototype.startsWith = function(chr){
	if (this.substring(0,chr.length) == chr) return true;
	else return false;
}

String.prototype.endsWith = function(chr){;
	if (this.substring(this.length-chr.length,this.length) == chr){
		 return true;
	}else{
		return false;
	}
}


var _fc = null;
var xtimer = null;

watchEvents();

function watchEvents(){
	_fc = document.getElementById("full_container");
	if (_fc == null){
		xtimer = window.setTimeout("watchEvents()",200);
		}else {
			
				window.clearTimeout(xtimer);
				installEvents();
			}
}

function installEvents(){
		_fc.onresize = function(){
			//_debug("resize fc");
		}




	_fc.onscroll = function(){
		redoShoppingCart();
	
}
}


function redoShoppingCart(){
	if (bullets.length > 0){
			i_clearBullets();
		}
	

			
			var cart = i_get("cartMainComplete");
			if (cart){
			var st = (i_getDocScroll(SCROLL_TOP));
			if (cart_default_left == -1) {
				cart_default_left = i_getLeft(cart);
				cart_default_top = i_getTop(cart);
				cart_default_parent = cart.offsetParent;
			}
			if (st >230){
				if (!cart_out){
				cart.style.position = "absolute";
				document.body.appendChild(cart);
				cart.style.top = (cart_default_top-275)+"px";
				cart.style.left = cart_default_left +"px";
				cart.style.backgroundImage = "url('/images/orangebg.png')";
				cart.style.backgroundPosition ="left -60px";
				cart_out = true;
				}
			}else{
			   if (cart_out){
					cart.style.position = "absolute";
					cart.style.left = cart_default_left-i_getLeft(cart_default_parent)+"px";
					cart.style.top = cart_default_top-i_getTop(cart_default_parent)+"px";
					cart.style.backgroundImage="url('/images/25white.png')";
					cart_default_parent.appendChild(cart);
					cart_out = false;
				}
			}
			}//if cart
				i_hidePopups();
				//i_hideToolTip();
		}


function i_get(objid){ //# get an element = document.getElementById()
	return document.getElementById(objid);
}

function i_getVal(objid){
	var obj = i_get(objid);

		if (obj.tagName == "TEXTAREA"){
				return obj.value;
		}else
		if (obj.tagName == "INPUT"){	
			if (obj.type == "text" || obj.type == "hidden"){
					return obj.value;
			}else
				if (obj.type == "checkbox"){
					if (obj.checked) return 1;
					else return 0;
				}else{
				return obj.value;
				}
		}else
			if (obj.tagName == "DIV" || obj.tagName == "SPAN")
			{
				return obj.innerHTML;
			}
		else if (obj.tagName == "SELECT"){
				return obj.value;
		}

}


function i_getSelected(objid){
		var obj = i_get(objid);
		if (obj.tagName == "INPUT"){
			 return obj.value;
		}else
		if (obj.tagName == "DIV" || obj.tagName == "SPAN"){
			return obj.innerHTML;
		}else
			if (obj.tagName == "SELECT"){
				for (var i = 0;i<obj.length ;i++ ){
					if (obj[i].selected == true){
							return obj[i].innerHTML;
					}
				}
			}

}


function i_setVis(objid,vis){
	var obj = i_get(objid);
	if (obj != null) obj.style.visibility = vis;
	
	
}

function i_setDisplay(objid,dis){
	i_get(objid).style.display = dis;
}

function i_setVal(objid,value,color){
		var obj = i_get(objid);
		if (obj == null) return;
			if (obj.tagName == "INPUT"){
				obj.value = value;
				if (color){
					obj.style.color = color;
				}
		}else
		if (obj.tagName == "DIV" || obj.tagName == "SPAN"){
			obj.innerHTML = value;
		}else
			if (obj.tagName == "SELECT"){
				for (var i = 0;i<obj.length ;i++ ){
					if (obj[i].value == value){
							obj[i].selected = true;
							break;
							return;
					}
				}
				for (var i = 0;i<obj.length ;i++ ){
					if (obj[i].innerHTML.toLowerCase() == value.toLowerCase()){
							obj[i].selected = true;
							break;
							return;
					}
				}
			}else
				if (obj.tagName == "IMG"){
					obj.src = value;
		}else
			if (obj.tagName == "TEXTAREA"){
				obj.value = value;
			}
}

function i_getCaretPos(oField) { //# get caret position from an input field or textarea
	var iCaretPos = 0;
	// IE Support
	if (document.selection) {
		oField.focus ();
		var oSel = document.selection.createRange ();
		oSel.moveStart ('character', -oField.value.length);
		// The caret position is selection length
		iCaretPos = oSel.text.length;
}

// Firefox support
else if (oField.selectionStart || oField.selectionStart == '0')
iCaretPos = oField.selectionStart;

// Return results
return (iCaretPos);
}


function i_setCaretPos (oField, iCaretPos,oldCaretPos) { //# set the caret (cursor) to a specified position in a input or textarea
	if (document.selection) {
		oField.focus ();
		var oSel = document.selection.createRange ();
		oSel.move ('character', -oField.value.length);
		oSel.moveStart ('character', iCaretPos);
		oSel.moveEnd ('character', 0);	
		oSel.select ();
		}

	// Firefox support
	else if (oField.selectionStart || oField.selectionStart == '0') {
	oField.selectionStart = iCaretPos;
	oField.selectionEnd = iCaretPos;
	oField.focus ();
	}
}




function i_showToolTip(obj,text,big,delay,autohide,color2){
	if (typeof(color2) == "undefined") color2= "red";


	if (obj.id.length == 0) obj.id = "tt_"+i_newID();
	
	if (typeof(autohide) == "undefined") autohide = true;
	var _prefix = "";
	if (big) _prefix = "big_";
		var gtc = i_get(_prefix+"general_tooltip_container");
		i_tooltip_gtc = gtc;
		var tobj = i_get(_prefix+"tool_tip_text");
		tobj.style.width = "1px";
		tobj.style.height = "1px";
		tobj.style.whiteSpace = "nowrap";
		tobj.innerHTML = text;
		var _left = i_getLeft(obj)+5;
		if (big) 	_left = i_currentX;

		if (big)	 gtc.style.left = parseInt(_left-15)+"px";
			else gtc.style.left =_left+"px";
		i_currentTTContainer = gtc;
		i_currentTTContainer._parent = obj;

		if (parseFloat(tobj.scrollWidth)>300){
					tobj.style.whiteSpace = "normal";
					tobj.style.width = "300px";
			}else{
					tobj.style.width = tobj.scrollWidth+"px";
			}	
		tobj.style.height = (tobj.scrollHeight+5)+"px";
		var _top = (i_getTop(obj)-parseInt(gtc.offsetHeight) );
		if (big) _top = _top+5;
		
		try{
			var _b = i_getDocScroll(SCROLL_TOP);
			if (_b > _top) _top = i_getTop(obj)+parseFloat(obj.offsetHeight)+5;
		}catch(e){
			//alert(e);
		}
		
	
	if (big)	_top = i_currentY + i_getDocScroll(SCROLL_TOP);
		gtc.style.top = _top+"px";

		delay = 1;
		tttimer = window.setTimeout("showToolTipTextContainer('"+_prefix+"','"+obj.id+"')",delay*10);

		if (autohide) window.setTimeout("i_hideToolTip()",3000);
}

function showToolTipTextContainer(_prefix,objid){
			var obj = i_get(objid);
			if (tttimer == null) return;
	
			var gtc = i_get(_prefix+"general_tooltip_container");
			gtc.style.visibility = "visible";
			gtc._isDialog = false;
			var _top = i_currentY;

			var _height = parseFloat(gtc.offsetHeight);
			var tobj = i_get(_prefix+"tool_tip_text");
			var key = tobj.innerHTML;
			if (key.startsWith("@")){
					tobj.innerHTML = "Loading ...";
					gtc._isDialog = true;
					key = key.substring(1);
					var _url = tt_url + key;
					xrr.post(_url, function(resObj){
							tobj.innerHTML = "<div>"+resObj.text+"</div>";
								
							if (parseFloat(tobj.scrollWidth)>300){
								tobj.style.whiteSpace = "normal";
								tobj.style.width = "300px";
							}else{
								tobj.style.width = tobj.scrollWidth+"px";
							}
							tobj.style.height = tobj.scrollHeight+"px";
							
							var newheight = parseFloat(gtc.offsetHeight);
							var dif = newheight-_height;
							_top = _top-dif;
							try{
									var _b = i_getDocScroll(SCROLL_TOP);
									if (_b > _top) _top = i_getTop(obj)+parseFloat(obj.offsetHeight)+5;
								}catch(e){
									//alert(e);
								}
							_top = i_currentY + i_getDocScroll(SCROLL_TOP)+5;
							gtc.style.top = parseFloat(_top)+"px";
							var _left = i_getLeft(tobj)+parseFloat(gtc.offsetWidth)-5;
							tobj.style. width = parseInt(tobj.offsetWidth)+"px";
							var _maxWidth = document.body.clientWidth;
							if (_left > (_maxWidth-20)){
								_left = _maxWidth - parseFloat(tobj.offsetWidth)-50;
								gtc.style.left = parseFloat(_left)+"px";
							}
				
					});
			}

			i_currentTTContainer = gtc;
			if (tttimer != null)	window.clearTimeout(tttimer);
}


function i_hideToolTip(){
		

		if(i_currentTTContainer && i_currentTTContainer._isDialog){
			return false;
		}

		var gtc = i_get("general_tooltip_container");
		if (gtc == null) return;
		gtc.style.left = "-200px";
		gtc.style.top = "-200px";
		var bgtc = i_get("big_general_tooltip_container");
		bgtc.style.visibility = "hidden";
		try{
		var tobj = i_get("big_tool_tip_text");
		tobj.innerHTML = "";
		tobj.style.width = "1px";
		tobj.style.height = "1px";
		}catch(e){}
		if (tttimer != null)	window.clearTimeout(tttimer);
		i_currentTTContainer = null;
		i_get("big_tool_tip_close_button").style.visibility = "hidden";
}


function i_verifyForm(formId){
	var form = i_get(formId);

	var canSubmit = checkForInput(form);
	if (canSubmit) {
			try{form.submit();}
			catch(e){}
	}
	else {
		try{
				var _form = i_get(formId);
				i_identifyFormProblem(_form);
				_form.onclick = function(){
					window.setTimeout("i_clearBullets()",1000);
					_form.onclick = null;
				}
				i_get(formId).onerror();
		}catch(e){}

		return false;
	}

	return true;
}

function i_flashObject(objid,color,k){
		var obj = i_get(objid);
		if (obj.style.borderColor != "white"){
			obj.style.border = "solid white 1px";
		}else{
			obj.style.border = "solid "+color +" 1px";
		}
		k = parseInt(k);
		k++;
		if (k <= 6) 	window.setTimeout("i_flashObject('"+objid+"','"+color+"','"+k+"');",500);
			else{
				obj.style.border = "solid transparent 1px";
			}
}

function i_identifyFormProblem(form){
	for (var i=0;i<form.childNodes.length ;i++ ){
			var obj = form.childNodes[i];
			if (obj != null && obj.tagName == "INPUT" && obj.type != "SUBMIT"){
				if (i_isDisplayable(obj)){
				if (obj.checkRegex) obj.checkRegex();
				
				if (obj.required && obj.value.length == 0) {
							answ = false;
							i_addBullet(obj,"required");
				}
				if (obj.regexResult == -1){
					answ = false;
					i_addBullet(obj,"invalid");
				}
				}
			}
			
			if (obj.childNodes.length > 0) i_identifyFormProblem(obj);
		
	}

}

function checkForInput(form){
	var answ = true;

	for (var i=0;i<form.childNodes.length ;i++ ){
			var obj = form.childNodes[i];
			if (obj != null && obj.tagName == "INPUT" && obj.type != "SUBMIT"){
				if (i_isDisplayable(obj)){
					if (obj.checkRegex) obj.checkRegex();
					if (obj.required && obj.value.length == 0) {
								answ = false;
					}

					if (i_isDisplayable(obj) && obj.regexResult == -1) answ = false;
				}
			}
			
			if (obj.childNodes.length > 0) answ = checkForInput(obj);
		if (!answ) return false;
	}


	return true;
}




function i_getParamsFromForm(form,sendBlank){
	if (typeof(sendBlank) == "undefined") sendBlank = false;
	{
	}
	
	var str = "";
	
	var size = form.childNodes.length;
	
	for (var i=0;i<size ;i++ ){
			var obj = form.childNodes[i];
			try{
			}catch(e){}
			
			if (obj != null && obj.tagName == "TEXTAREA"){
				if (sendBlank){
					str += obj.name + "="+escapeURICom(obj.value)+"&";
				}else{
				if (obj.value.length > 0) {
					str += obj.name + "="+escapeURICom(obj.value)+"&";
				}
			}
			}
			if (obj != null && obj.tagName == "INPUT" && obj.type.toLowerCase() != "submit" && obj.type.toLowerCase() != "checkbox" && obj.type.toLowerCase() != "radio" && obj.type.toLowerCase() != "button" && obj.tagName != "OPTION" && obj.name && i_isDisplayable(obj)){
				if (sendBlank){
					str += obj.name + "="+escapeURICom(obj.value)+"&";
				}else{
				if (obj.value.length > 0) {
					str += obj.name + "="+escapeURICom(obj.value)+"&";
				}
				}
			}
			if (obj != null && obj.tagName == "INPUT" && obj.type.toLowerCase() == "radio"  && i_isDisplayable(obj)){
				if (obj.checked) str += obj.name + "="+escapeURICom(obj.value)+"&";
			}
			if (obj != null && obj.tagName == "INPUT" && obj.type.toLowerCase() == "checkbox"  && i_isDisplayable(obj)){
					if (obj.checked) str += obj.name + "=1&";
						else str += obj.name +"=0&";
			}
			if (obj != null && obj.tagName == "SELECT" && obj.name  && i_isDisplayable(obj)){
				str+=obj.name+"="+escapeURICom(obj.value)+"&";
			}
			if (obj != null && obj.childNodes.length > 0 && obj.tagName != "SELECT") str += i_getParamsFromForm(obj,sendBlank);
	}
	
	return str;
}

function escapeURICom(val){
	val = encodeURIComponent(val);
	val = i_replaceStr(val,"&","~amp;");
	return val;
}
//xml request response engine
var xrr = new XMLRequestResponse();

function XMLRequestResponse(){
		this.get							=xrr_doGet;
		this.post							= xrr_doPost;
		this.tryToParse				=xrr_parse;
		this.onfailed					=xrr_onfailed;
}


function xrr_doGet(url,onloadf,onfailedf){
	var req ;
	req = false;

    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Microsoft.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.onreadystatechange = function(){			
				
				if (req.readyState == 4) {
						if (req.status == 403 || req.status== 404 || req.status == 500){
							if (onfailedf) onfailedf(req.status);
							else xrr.onfailed(req.status,url);
						}

						if (req.status == 0){
							if (onfailedf) onfailedf(PERMISION_DENIED);
							else xrr.onfailed(PERMISION_DENIED,url);
			
						}
				        if (req.status == 200) {
							
							onloadf(xrr.tryToParse(req.responseText));
							try{
								installToolTipOn("IMG","info");
							}catch(e){
								//alert(e);
							}
						}
				}
		}
		try{
		req.open("GET", url, true);
		req.send("");
		}catch(ex){
			if (onfailedf) onfailedf(PERMISION_DENIED);
			else xrr.onfailed(PERMISION_DENIED,url);
			
		}
	}
	
	return req;
}//doget


function xrr_doPost(url,onloadf,onfailedf){
var req ;

	req = false;

    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Microsoft.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		isBusy = true;
		req.onreadystatechange = function(){
			
				if (req.readyState == 4) {
						if (req.status == 403 || req.status== 404 || req.status == 500){
							if (onfailedf) onfailedf(req.status,req.responseText);
							else xrr.onfailed(req.status,url,req.responseText);
						}
						if (req.status == 0){				
							if (onfailedf) onfailedf(PERMISION_DENIED);
							else xrr.onfailed(PERMISION_DENIED,url);
						}
				        if (req.status == 200) {
							
							onloadf(xrr.tryToParse(req.responseText));
							installToolTipOn("IMG","info");
							
						}
				}
		}
		
		var params = "";
		if (url.indexOf("?")>-1){
			params = url.substring(url.indexOf("?")+1);
			url = url.substring(0,url.indexOf("?"));
		}

		try{
		req.open("POST", url, true);
		req.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		//req.setRequestHeader("Content-length", params.length);
		//req.setRequestHeader("Connection", "close");
		req.send(params);
		}catch(e){
							if (onfailedf) onfailedf(PERMISION_DENIED);
							else xrr.onfailed(PERMISION_DENIED,url);
			
		}
	}

	return req;
}//dopost


function xrr_parse(text){
	try{
			 myData = json_parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });
	}catch(e){
		myData = text;

	}
		if (myData.xrr_goto){
			if (myData.xrr_reason){
					alert(myData.xrr_reason);
			}
			window.open(myData.xrr_goto,"_top");
		}
		return myData;
}


function xrr_onfailed(err,url,res){
	try{
	var myurl = this.tryToParse(res);
	var _url = "/de/error/error/";
	if (typeof(myurl.url) != "undefined") _url = myurl.url;
	window.open(_url,"_top");
	}catch(Exce){
	}

}

var CArr = 0;
var IdArrays = new Array();


function IDExists(s){
for (var i=0;i<(CArr+1);i++ )
	{
	if (IdArrays[i]==s)
		{
		return true;
		}	
}
IdArrays[CArr]=s
CArr++
return false;
}
function i_newID(){
	try{
		var s=""
		var d = new Date();
		s= d.getTime();
		var r=IDExists(s);
		if (r==true)
			{
			i_newID()
			}
		else{
		return s;
		}
	}
	catch(e)
	{
		i_newID();
	}

return IdArrays[CArr-1]
}


var _blackscreen = null;

function i_createBlackScreen(){
	_blackscreen = document.createElement("DIV");
	_blackscreen.style.position = "absolute";
	_blackscreen.style.top = 0+"px";
	_blackscreen.style.left = 0+"px";
	_blackscreen.style.width = "100%";
	var fc = i_get("full_container");

	var _height = document.body.scrollHeight;
	_height = fc.offsetHeight;
	_blackscreen.style.height = _height+"px";
	_blackscreen.style.backgroundImage = "url('/images/50black.png')";
	document.body.appendChild(_blackscreen);
	_blackscreen.style.zIndex = 6000;
	_blackscreen.style.visibility = "visible";
}

function i_showBS(){
	if (_blackscreen == null){
		i_createBlackScreen();
	}else{
		_blackscreen.style.visibility = "visible";
	}
}

function i_hideBS(){
	_blackscreen.style.visibility = "hidden";
}


var _dialogs = new Array();

function i_resizeDialog(did,width,height){
	var _dlg = i_get("dlg_"+did);
	
	_dlg.style.height = height + "px";
	_dlg.childNodes[0].style.height = parseInt(height-13)+"px";
	_dlg.childNodes[1].style.height = parseInt(height-13)+"px";
	_dlg.childNodes[2].style.height = "20px";
	_dlg.childNodes[3].style.height = "20px";
	_dlg.childNodes[4].style.height = "20px";
	var _dc = i_get("dialog_container_"+did);

	_dc.style.height = parseInt(height-80)+"px";
	var _scrollTop = document.documentElement.scrollTop;
		if (!i_isIE) _scrollTop = window.pageYOffset;
	
		 var viewportwidth;
		 var viewportheight;
		  
		 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		  
		 if (typeof window.innerWidth != 'undefined')
		 {
		      viewportwidth = window.innerWidth,
		      viewportheight = window.innerHeight
		 }
		  
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		 
		 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientWidth !=
		 'undefined' && document.documentElement.clientWidth != 0)
		 {
		       viewportwidth = document.documentElement.clientWidth,
		       viewportheight = document.documentElement.clientHeight
		 }
		  
		 // older versions of IE
		  
		 else
		 {
		       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		   viewportheight = document.getElementsByTagName('body')[0].clientHeight
		 }

	var top = (viewportheight)/2-height/2 + _scrollTop;
	
	_dlg.style.top = top+"px";

}

function i_dialog(title,url,width,height,noajax){
	i_showBS();
		var _dlg = document.createElement("DIV");	
		_dlg.style.position = "absolute";
		
		var myID= i_newID();
		
		var _scrollTop = document.documentElement.scrollTop;
		if (!i_isIE) _scrollTop = window.pageYOffset;
			
		 var viewportwidth;
		 var viewportheight;
		  
		 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		  
		 if (typeof window.innerWidth != 'undefined')
		 {
		      viewportwidth = window.innerWidth,
		      viewportheight = window.innerHeight
		 }
		  
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		 
		 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientWidth !=
		 'undefined' && document.documentElement.clientWidth != 0)
		 {
		       viewportwidth = document.documentElement.clientWidth,
		       viewportheight = document.documentElement.clientHeight
		 }
		  
		 // older versions of IE
		  
		 else
		 {
		       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		   viewportheight = document.getElementsByTagName('body')[0].clientHeight
		 }

		var top = ((viewportheight)/2-height/2) + _scrollTop;
			var fc = i_get("full_container");
		var left = viewportwidth/2-width/2;
		document.body.style.overflow = "hidden";
	

			_dlg.style.overflow = "visible";

			 _dlg.innerHTML = "<div style='background-image:url(/images/bigshadow.png);width:"+(parseInt(width)-20)+"px;height:"+(parseInt(height)-13)+"px;float:left;cursor:default;'></div>"+
						"<div style='background-image:url(/images/bigshadow.png);background-position:-970px top;background-repeat:no-repeat;width:20px;height:"+(parseInt(height)-13)+"px;float:right;'></div>"+
						"<div style='background-image:url(/images/bigshadow.png);float:left;background-position:left -694px;background-repeat:no-repeat;width:"+(parseInt(width)-20)+"px;height:20px;'></div>"+
						"<div style='background-image:url(/images/bigshadow.png);float:right;background-position:-970px -694px;background-repeat:no-repeat;width:20px;height:20px;'></div>"+
						"<div id='dddd_' style='position:absolute;left:15px;top:17px;width:"+(parseInt(width)-26)+"px;height:20px;'><div class='dialog_title' style='float:left;margin-left:10px;'>"+title+"</div><div class='close_delete' style='float:right;margin-right:10px;' onclick='i_close_dialog(&quot;"+myID+"&quot;)'></div></div>"+
						"<div id='dialog_container_"+myID+"' style='background-image:url(/images/spinner.gif);background-repeat:no-repeat;background-position:center center;overflow:hidden;z-index:3000;position:absolute;left:15px;top:39px;width:"+(parseInt(width)-46)+"px;height:"+(parseInt(height)-80)+"px;padding:10px;'></div>"
						;
		
			_dlg.style.left = left+"px"; _dlg.style.top = top+"px"; _dlg.style.width = (width)+"px"; _dlg.style.height = (height)+"px";
			_dlg.style.zIndex = 10000;
			_dlg.style.visibility = "visible";
			_dlg.id = "dlg_"+myID;
			
			document.body.appendChild(_dlg);

			this.objIndex = _dialogs.length;
			this.dlg = _dlg;
			this.returnValue = "-1";
			_dialogs[_dialogs.length] = this;


		if (noajax){
			var _dlg = i_get("dialog_container_"+myID);
			if (url.indexOf("?")==-1)	{
				url +="?did="+myID;
			}else{
				url+="&did="+myID;
			}
			_dlg.innerHTML = "<iframe style='width:100%;height:100%' src='"+url+"' frameborder='0' scrolling='no' allowtransparency='true'></iframe>";
		}else{
				xrr.get(url,function(resob){
					i_get("dialog_container_"+myID).style.backgroundImage = "none";
					i_get("dialog_container_"+myID).innerHTML = resob;
				});
		}
	
	return this;
}


function i_setReturnValue(did,rv){
	var _dlg = i_get("dlg_"+did);
	var mydlg = null;
	
	for (var i=0;i<_dialogs.length;i++){
		if (_dialogs[i].dlg == _dlg){
			mydlg = _dialogs[i];
			break;
		}
	}
	mydlg.returnValue = rv;

}

function i_close_dialog(did){
	var _dlg = i_get("dlg_"+did);
	var mydlg = null;
	
	for (var i=0;i<_dialogs.length;i++){
		if (_dialogs[i].dlg == _dlg){
			mydlg = _dialogs[i];
			break;
		}
	}
	document.body.style.overflow = "auto";
	try{
		mydlg.onclose();
	}catch(e){
	
	}
	document.body.removeChild(_dlg);
	i_hideBS();
	
}


function installToolTipOn(TAG,className,color2){
	if (typeof(color2) == "undefined") color2 = "red";

	var objects = document.getElementsByTagName(TAG);
	var t = "";
	try{
	for (var i=0;i<objects.length;i++){
			var obj = objects[i];
			
			if (obj.className  == className && obj.title.length != 0){
				obj._title = obj.title;
				obj.title = "";
				if (obj._title.startsWith("@")){
					obj._isDialog = true;
					obj.onclick = function(){
						if (i_currentTTContainer){
							if (i_currentTTContainer._parent == this){
								i_currentTTContainer = null;
								i_hideToolTip();
							}else{
							i_get("big_tool_tip_close_button").style.visibility = "visible";
							i_showToolTip(this,this._title,true,false);
							i_currentTTContainer._parent = this;
							}
						}else{
							i_get("big_tool_tip_close_button").style.visibility = "visible";
							i_showToolTip(this,this._title,true,false);
							i_currentTTContainer._parent = this;
							
						}
					}

				}else{

				obj.onmouseover = function(){	 
					//function i_showToolTip(obj,text,big,delay,autohide){

					i_showToolTip(this,this._title,false,false,color2);
					i_currentTTContainer._parent = this;
				}

				obj.onmouseout = function(evt){
					tttimer = null;
				}
				}
			}
	}

	}catch(e){
		//alert(e);
	}
}


function i_reformatDomain(domain,dext){
	if (domain.indexOf(".")>-1 && dext.indexOf("name")==-1 ){
		domain = domain.substring(0,domain.indexOf("."));
	}

	return domain+"."+dext;
}

function i_mouseInside(obj){
	var _left = parseFloat(obj.style.left);
	var _top = parseFloat(obj.style.top);
	var _width = parseFloat(obj.offsetWidth);
	var _height = parseFloat(obj.offsetHeight);
	var result = false;
	if (i_mouse_x > _left && i_mouse_x < parseInt(_left+_width) && i_mouse_y >= _top && i_mouse_y <= (_top+_height)){
		
		result = true;
	}
	return result;
}



function i_mouseIsInside(obj){
	var _left = parseFloat(i_tooltip_gtc.style.left);
	var _top = parseFloat(i_tooltip_gtc.style.top);
	var _width = parseFloat(i_tooltip_gtc.offsetWidth);
	var _height = parseFloat(i_tooltip_gtc.offsetHeight);
	var result = false;
	if (i_mouse_x > _left && i_mouse_x < parseInt(_left+_width) && i_mouse_y >= _top && i_mouse_y <= (_top+_height)){
		
		result = true;
	}
	return result;
}

function i_addBullet(obj,type){
	

	try{

	var _top = i_getTop(obj)-i_getDocScroll(SCROLL_TOP);
	var bullet = document.createElement("DIV");
	bullet.style.position = "absolute";
	bullet.style.top = _top+"px";
	bullet.style.height = "14px";
	bullet.style.paddingLeft = "5px";
	bullet.style.paddingRight = "5px";
	bullet.style.fontWeight="bolder";
	bullet.style.fontSize = "9px";
	bullet.style.color = "white";
	bullet.style.backgroundPosition = "left center";
	bullet.style.zIndex = 5000;
	if (type == "invalid"){
	bullet.style.backgroundImage = "url('/images/redbg.png')";
	bullet.innerHTML = i_invalidText;
	}else
		if (type == "required")	{
			bullet.style.backgroundImage = "url('/images/redbg.png')";
			bullet.innerHTML = i_requiredText;
		}
	document.body.appendChild(bullet);
			var _left = i_getLeft(obj)+parseInt(obj.offsetWidth)-5-parseInt(bullet.offsetWidth);
		bullet.style.left = _left + "px";
	bullets[bullets.length] = bullet;
	}catch(e){
	}
}

function i_clearBullets(){
	for (var i=0;i<bullets.length ;i++ ){
		document.body.removeChild(bullets[i]);
	}
	bullets = new Array();
}

var i_loadingHTML = "<table border='0' cellspacing='2' cellpadding='2' width='100%' height='200px' class='simple_table'>";
	i_loadingHTML += "<tr>";
	i_loadingHTML +="<td align='center' valign='middle'>";
	i_loadingHTML +="<img src='/images/spinner.gif'/>";
	i_loadingHTML +="</td></tr></table>";


 function i_cancelBubeling(evt){
		if (i_isIE) evt = event;
		try{
		 evt.cancelBubble = true;
		if (evt.stopPropagation) evt.stopPropagation();
		}catch(e){}
 }

 function i_donothing(){
 }

function i_registerEnter(objid,funct){
	var txt= i_get(objid);
	if (txt == null) return;

		txt.onkeyup = function(evt){
			if (typeof(event) != "undefined") evt = event;
			if (evt.keyCode == 13){
				eval(funct);
			}
		}

}

 function i_deleteRow(divrow){
	divrow.style.display = "none";
 }



function showLoading(){
	var _ld = i_get("_loadingdiv");
	_ld.style.display = "block";
		var _rc = i_get("maincontent");

		if (_rc == null){
			_rc = i_get("maincontent_small");
			_ld.style.left = (i_getLeft(_rc))+"px";
			_ld.style.width = (parseFloat(_rc.offsetWidth))+"px";
		_ld.style.top = (i_getTop(_rc)+0)+"px";
		_ld.style.height = (parseInt(_rc.offsetHeight)-1)+"px";	
		}else{
		_ld.style.left = (i_getLeft(_rc)+170)+"px";
		_ld.style.width = (parseFloat(_rc.offsetWidth)-170)+"px";
		_ld.style.top = (i_getTop(_rc)+20)+"px";
		_ld.style.height = (parseInt(_rc.offsetHeight)-25)+"px";	
		}

		_ld.style.zIndex = 10000;
}

function hideLoading(){
	i_setDisplay("_loadingdiv","none");
	var _ld = i_get("_loadingdiv");
		var _rc = i_get("maincontent");
		if (_rc == null) _rc = i_get("maincontent_small");
	_ld.style.height = (parseInt(_rc.offsetHeight))+"px";	
}

function i_getParent(object,parentId){
	if (!object) return null;
	var parent = object.parentNode;
	while (parent){
		if (typeof(parent.id) != "undefined" && parent.id.indexOf(parentId)>-1){
			return parent;
		}
		parent = parent.parentNode;
	}

	return null;

}

function i_hasParent(object,parentId){
	if (!object) return false;
	var parent = object.parentNode;
	while (parent){
		if (parent.id == parentId){
			return true;
		}
		parent = parent.parentNode;
	}

	return false;
}


function i_focus(objid){
	var obj = i_get(objid);
	if (obj){
		obj.focus();
		obj.select();
	}
}

function i_encode(str){
	str = i_replaceStr(str,"&amp;","&");
	str = encodeURIComponent(str);
	str = str.replace(/\+/g,'%2B');
	return str;
}

/** normal tool tip **/

function i_toolTipOn(tagName,className){
	var objects = document.getElementsByTagName(tagName);
	var t = "";
	for (var i=0;i<objects.length ;i++){
			var obj = objects[i];
			
			if (obj.className  == className && obj.title.length != 0){
				t+=obj.className + "\n";
				obj._title = obj.title;
				obj.title = "";

				obj.onmouseover = function(){
					var x = i_get("normal_tooltip_container");	
					x.style.left = i_getLeft(this)+"px";
					var xt = i_get("normal_tooltip_container_text");
					
					xt.innerHTML = this._title;
					var _width = parseInt(x.offsetWidth);
					x.style.visibility = "visible";
					var _top = i_getTop(this) - parseInt(parseFloat(x.offsetHeight));
					x.style.top = _top+"px";
					
				}

				obj.onmouseout = function(){
						var x = i_get("normal_tooltip_container");	
						var xt = i_get("normal_tooltip_container_text");
						x.style.visibility = "hidden";
						xt.innerHTML = "";
				}
			}
	}
}


function i_updateCart(items,priceStr){
	var cmp = i_get("cartMainPrice");
	var cmc = i_get("cartMainCount");
	var cart = i_get("cartMainComplete");
	cmp.innerHTML = priceStr;
	cmc.innerHTML = items;
	if (items > 0){
		cart.style.visibility = "visible";
	}else{
		cart.style.visibility = "hidden";
	}
}	


function i_setSelected(obj,value){
		if (typeof(obj)=="string") obj = i_get(obj);

		if (obj.tagName == "SELECT"){
	for (var i = 0;i<obj.length ;i++ ){
					if (obj[i].innerHTML == value){
							obj[i].selected = true;
							break;
					}
	}
		}

}

function i_getSelected(obj){
	
	if (typeof(obj)=="string") obj = i_get(obj);

		if (obj.tagName == "INPUT"){
			 return obj.value;
		}else
		if (obj.tagName == "DIV" || obj.tagName == "SPAN"){
			return obj.innerHTML;
		}else
			if (obj.tagName == "SELECT"){
				for (var i = 0;i<obj.length ;i++ ){
					if (obj[i].selected == true){
							return obj[i].innerHTML;
					}
				}
			}

}


function i_getValue(obj){
		if (typeof(obj)=="string") obj = i_get(obj);

		if (obj == null){
				alert("not found "+objid);
			return -1;
		}
		
		if (obj.tagName == "TEXTAREA"){
				return obj.value;
		}
	
		if (obj.tagName == "INPUT"){	
			if (obj.type == "text" || obj.type == "hidden"){
					return obj.value;
			}else
				if (obj.type == "checkbox"){
					if (obj.checked) return 1;
					else return 0;
				}else{
				return obj.value;
				}
		}else
			if (obj.tagName == "DIV" || obj.tagName == "SPAN")
			{
				return obj.innerHTML;
			}
		else if (obj.tagName == "SELECT"){
				return obj.value;
		}
}

function i_setValue(obj,value,color){
		if (typeof(obj)=="string") obj = i_get(obj);

		if (obj == null) return;
		if (obj.tagName == "INPUT"){
				obj.value = value;
				if (color){
					obj.style.color = color;
				}
		}else
		if (obj.tagName == "DIV" || obj.tagName == "SPAN"){
			obj.innerHTML = value;
		}else
			if (obj.tagName == "SELECT"){
				for (var i = 0;i<obj.length ;i++ ){
					if (obj[i].value == value){
							obj[i].selected = true;
							break;
					}
				}
			}else
				if (obj.tagName == "IMG"){
					obj.src = value;
		}else
			if (obj.tagName == "TEXTAREA"){
				obj.value = value;
			}
}

function i_setSelected(obj,value){
		if (typeof(obj)=="string") obj = i_get(obj);

		if (obj.tagName == "SELECT"){
			for (var i = 0;i<obj.length ;i++ ){
				if (obj[i].innerHTML == value){
						obj[i].selected = true;
						break;
				}
			}
		}

}
