/*	OSDHTMLLib.js: Base routines for w2Forms	original and creative work by Ian Sharrock - http://www.sharrock.net.au/Ian		Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/	basically, do anything you want, 	    	*  You can use, modify and distribute the software, but do so in the spirit of Open Source.    		*  You need to leave my name and link intact.    		*  Give credit where credit is due.*/ Date.prototype.dateOnly = function(){ return(new Date(this.getFullYear(),this.getMonth(),this.getDate())) };Date.prototype.add = function (y,m,d){return( new Date(this.getTime()+ (d*1000*3600*24) ))}; // do the rest when requiredString.prototype.toDate= function(){ var v = this.split("/") ; return (v.length == 3 ? new Date(v[2],(v[1]-1),v[0]): new Date()) };Date.prototype.format= function(fmt,usfmt) {	var m = "Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec".split("/")	var lm = "January/February/March/April/May/June/July/August/September/October/November/December".split("/")	var w = "Sun/Mon/Tue/Wed/Thu/Fri/Sat/Sun".split("/")	var lw = "Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday".split("/")	switch(fmt){	 case "DD/MM/YYYY":	return((this.getDate()< 10 ? "0":"") +  this.getDate()+ "/" + (this.getMonth()< 9 ? "0":"") + (this.getMonth() +1)+ "/" +  this.getFullYear())	 case "dddd dd mmmm yyyy":	return(lw[this.getDay()] + " " + this.getDate() + " " + lm[this.getMonth()] )  + " " + this.getFullYear()// + ", " + this.getHours() + ":" + this.getMinutes()  )	 case "dddd": return(lw[this.getDay()]);	 case "dd mmm": return(this.getDate() + " " + m[this.getMonth()] );	 case "dd mmm yyyy":	return(this.getDate() + " " + m[this.getMonth()] )  + " " + this.getFullYear()// + ", " + this.getHours() + ":" + this.getMinutes()  )	 default:return(w[this.getDay()] + " " + this.getDate() + " " + m[this.getMonth()] )  + " " + this.getFullYear()// + ", " + this.getHours() + ":" + this.getMinutes()  )	}};String.prototype.stripHTML = function(){var t=this;var re = /(<([^>]+)>)/gi;return(this.replace(re, ""))}String.prototype.trim = function() {a = this.replace(/^\s+/, '');	return a.replace(/\s+$/, '');};String.prototype.escHtml = function(){var i,e={'&':'&amp;' , '<':'&lt;','>':'&gt;','"':'&quot;' },t=this;for(i in e) t=t.replace(new RegExp(i,'g'),e[i]); return t } Number.prototype.format= function(fmt){//"HH:MM AM"	var m = Math.floor(this/60)	var r = this%60 	return( (m<10? "0":"" ) + m  + ":" + (r < 10? "0": "") + r ) }Array.prototype.indexOf = function(str,ignoreCase) {	var tmp ;	if (typeof(str)=="string" && ignoreCase) str = str.toLowerCase() ;	for (var i=0; i<this.length; i++) {		if (typeof(str)=="string" && ignoreCase) tmp=this[i].toLowerCase() ;		else tmp=this[i] ;		if (tmp==str) return i ;	}	return -1 ;}var IE = (document.all && document.getElementById) == undefined ? false : truevar IELst = []; // we an internal list of screen objects to implment a work around IE bugfunction dropShad(tob,s){		var ob = nDOMObj(tob,"div",{style:"background: url('/" + dbname + "/shadowAlpha.png') no-repeat bottom right !important;background: url('/" + dbname + "/shadow.gif') no-repeat bottom right;padding: 0;" + (s== undefined || s.f== undefined ? "":s.f)} )	return (nDOMObj(ob,"div",{style: "background-color:white;border: 1px solid #E7E7E8;position:relative;bottom:6;right:6;padding:4;margin:0 0 0 0;" + (s== undefined || s.l== undefined ? "":s.l)}))   ///+ )))}	function doKeydown(e,ob,fi,tp){     var Cde = e.keyCode     var nCe = (tp== 15 || tp== 85 || tp== 45? true:false)     if(Cde==13)return tp == 41 ? true : false     ob.OSCde == -1      switch(Cde){          case 8:  //bs          case 46:   //del          if(nCe) return(beep())                              case 9: //tab          case 40: //down          case 38: //upo               return true                    default:               if(nCe) return(beep())                           if(tp != 70  || Cde == 190   || Cde == 110   ||  (Cde >= 48 && Cde <=57 )  || (Cde >= 96 && Cde <=105))return true               return(beep())     }     function beep(){          try{               if((IE))beepObj.src = w2Pth + "/OSError.wav"               else {                    if(beepObj.src =="") beepObj.src= w2Pth+  "/OSError.wav"                     else beepObj.Play()                }          }catch(e){}          return false;     }} function objVal(nm,sOb){	var Obj = null;	try{		var Obj =  sOb == undefined ? document.getElementsByName(nm): sOb  // do it this way so as not to exposes bugs in IE		if(Obj.length == undefined){			return getV(Obj)				}					for(var i = 0; i < Obj.length; i++) {			if(Obj[i].tagName  == "TEXTAREA" ) return (Obj[i].OSEn == false ? "" : Obj[i].value)			if(Obj[i].type  == "text" || Obj[i].type  == "password") return (Obj[i].OSEn == false ? "" : Obj[i].value)			if(Obj[i].checked == true) return Obj[i].value;  //multi value field		}	}catch(e){alert("Unable to determine a value for " + nm )	}	return("")	function getV(Ob){		if(Ob.tagName  == "TEXTAREA" ) return (Ob.OSEn == false ? "" : Ob.value)		if(Ob.type  == "text" || Ob.type  == "password") return (Ob.OSEn == false ? "" : Ob.value)		if(Ob.checked == true) return Ob.value;  //multi value field		}	}function newEvent(ob,nm,func){	if(typeof (ob) != "object") return 	if(typeof(ob.length)=="number"){		var aa = typeof (ob) 		for(var i=0;i<ob.length;i++){			newEvent(ob[i],nm,func)			return		}	} 	if(typeof func != 'string' && func != undefined) func = "" + func + ""	if(IE)  ob[nm]= func == undefined ? "" : typeof func == 'function'? func : new Function(func);	else ob.setAttribute(nm,func)}function nDOMObj(aob,ta,ty,n,v,id,cls,w,ht,st){		var ob = document.createElement(ta)	if(typeof(ty) == "object"){		var id = ty.id		var ht = ty.html		var cls = ty.cls		var st = ty.style			var w = ty.wi		var n = ty.na			var v = ty.va		var T = ty.ty	}else var T = ty	if(IE && T == "radio"){  // fix for IE bug		var ob = document.createElement('<input type=radio name="' + na +'" value="'+ va +'"  >' ); // to radio make it work with IE bug	}else{		if(n!= undefined && n !="") ob.setAttribute("name",n);		if(T!= undefined && T !="")ob.setAttribute("type",ty)	}	if(id!= undefined && id !="") ob.setAttribute("id",id);	if(v!= undefined  && v !="") ob.setAttribute("value",v);	if(cls!= undefined && cls !="") ob.setAttribute("class",cls);	if(cls!= undefined && cls !="") ob.setAttribute("className",cls);	if(w!= undefined && w!= "" )	ob.style.width = w;	if(ht!= undefined &&  ht !="") ob.innerHTML = ht		ob.osClass = function (st){		ob.setAttribute("className",st)		ob.setAttribute("class",st)	}	ob.osStyle = function(st){		if(IE)ob.style.setAttribute('cssText',st,0); 		else ob.setAttribute("style", st)	}	if(st!= undefined &&  st.trim() !="") ob.osStyle(st)	if(aob!= null) aob.appendChild(ob);	return(ob)}function  newTabbed(lt,tg,h){	var ob = nDOMObj(null,"div",{style:"w2Tabbed"});		ob.lob= [];ob.Tab =  [];	var uob = nDOMObj(ob,"ul",{cls:"tabNav",wi:h == undefined ? "100%":"64%"}) //,"tabNav")	for(var i=0;i<lt.length;i++){		var l = nDOMObj(uob,"li");			var a = nDOMObj(l,"a",{html:lt[i]});			ob.lob[lt[i]] = l					a.root = ob		newEvent(a,"onclick","this.root.selTab('" + lt[i]+ "');")		 	}	if(h != undefined) nDOMObj(ob,"H2","","","","","","",h)	ddob = nDOMObj(ob,"div",{style:"float:left;border-top:1px solid #B2B2B2;margin-bottom:1em;overflow:hidden;width:100%;"})	for(var i=0;i<lt.length;i++){		ob.Tab[lt[i]] = nDOMObj(ddob,"div",{style:"margin:10px;width100%;display:none"})		ob.Tab[lt[i]].eobs = []	}	ob.sel= l	ob.MCEInit = false	ob.seli = lt[lt.length-1]	ob.selTab = function (l){		ob.sel.osClass("");		ob.lob[l].osClass("selected");		ob.sel = ob.lob[l]		ob.Tab[ob.seli].style.display ="none"			ob.Tab[l].style.display ="block"						ob.seli = l		if(ob.Tab[l].eobs.length>0 ){						if(!ob.MCEInit){				ob.MCEInit = true				tinyMCE.init({mode : "none",theme : "w2Forms",					plugins: "inlinepopups",		//	oninit : function (){w2Frm.bodyObj.parentNode.parentNode.onClick(0)  ;},					theme_advanced_toolbar_location : "top",theme_advanced_toolbar_align : "left",					theme_advanced_path_location : "bottom",theme_advanced_resizing :false,					content_css : "/" + w2Pth+ "/styles/editor.css",					height:480}				);			}			tinyMCE.idCounter=0;			for(var i=0; i<ob.Tab[l].eobs.length ;i++){				tinyMCE.execCommand('mceAddControl',true,ob.Tab[l].eobs[i].id); 			}			ob.Tab[l].eobs = []		}	}	if(tg != undefined) tg.appendChild(ob)	return ob}function newTwistySection(lt,tg){	var ob = nDOMObj(null,"div",{cls:"w2Twisties"});		ob.Tab =  [];	var _self = ob	for(var i=0;i<lt.length;i++){		var a = nDOMObj(ob,"div",{cls:"out",html:lt[i]});		a.osOver = "over"		a.osOut = "out"		a.onmouseover = function(){this.osClass(this.osOver)}		a.onmouseout = function(){this.osClass(this.osOut)}				a.onclick = function() {_self.selTab(this,this.OSidx)};		a.OSidx = i	 		a.OSob = ob.Tab[i]= nDOMObj(ob,"div",{style:"margin:0px;width100%;display:none"})	}	ob.sel = undefined	ob.selTab = function (a,j){			var eq = ob.sel == a		if(this.sel != undefined){			this.sel.OSob.style.display ="none"			this.sel.osOver = "over"			this.sel.osOut = "out"			this.sel.osClass(this.sel.osOut)			this.sel = undefined		}		if(!eq && a.osOut == "out"){ 			a.OSob.style.display ="block"						a.osOver = "overSelect"			a.osOut = "outSelect"			a.osClass(a.osOut )			this.sel = a		}	}	tg.appendChild(ob)	return ob}//function newTable(mob,lab,tlst,nrws,obf,cls){function newTable(mob,S) {		if(S == undefined){		var T = nDOMObj(nDOMObj(mob, "table"),"tbody")		T.parentNode.border = T.parentNode.cellSpacing = T.parentNode.cellPadding = 0 		T.parentNode.align = "center" 		return(T)	}		var lst =  "tbody/colgroup/table".split("/")	S.tls.push(S.bdr == undefined ? 5 :S. bdr );		S.tls.unshift(S.bdr == undefined ? 5 :S. bdr)	var alst =new Array()	for (var i=0 ; i<lst.length;i++){		alst[i]= nDOMObj(null,lst[i]);		switch (lst[i]){			case "tbody":				alst[i].osClass(S.cls == undefined ? "w2dBox": S.cls);				alst[i].ov = function ov(fl,evt){					var _self = this										var n=evt.srcElement == undefined ? evt.target : evt.srcElement										while (n != undefined && n.nodeName != "TR" ) n = n.parentNode					if(n == undefined || n.nodeName != "TR" || n.getElementsByTagName("TABLE").length) st(this.tr,false)							else if( n.getElementsByTagName("A").length || (n.getElementsByTagName("INPUT").length  && n.getElementsByTagName("INPUT")[0].getAttribute('type') != 'button')){						st(this.tr,false);st(n,true);this.tr = n					}					else st(this.tr,false)					function st(n,c){						if(n== undefined ) return												for(var i=0 ;i<n.childNodes.length;i++){							var o = n.childNodes[i]													if(o.OSClass == undefined)o.OSClass = o.getAttribute("class")							if(o.OSClass.indexOf("T") == 0 )o.osClass((c ? "over " : "") +o.OSClass  );						}					}					}				alst[i].onmouseover = function ss(event){this.ov(true,event)}				alst[i].onmouseout = function ss(event){this.ov(false,event)}								break;							case "table":				alst[i].border = alst[i].cellPadding  =	alst[i].cellSpacing = 0 				alst[i].align = "center" 				alst[i].appendChild(alst[i-1]) ;				alst[i].appendChild(alst[i-2]) ;									break;						case "colgroup":				alst[i].span = S.tls.length ;				for (j=0; j<S.tls.length;j++) nDOMObj(alst[i],"col",{wi:S.tls[j]+ "px" } );				break;			}	}	if(S.lab != undefined){		var row = nDOMObj(alst[0],"TR");		nDOMObj(alst[0],"TD",{cls:"topLeft"});			nDOMObj(alst[0],"TD",{cls:"topCenter",html:S.lab}).colSpan = S.tls.length-2						nDOMObj(alst[0],"TD",{cls:"topRight"});		}		mob.appendChild(alst[lst.length-1]);	for(i=1 ; i<=S.rws;i++){		var row = nDOMObj(alst[0],"TR");		if (i== S.rws){			nDOMObj(row,"TD",{cls:"bottomLeftStatus"});				var ob = nDOMObj(row,"TD",{cls:"bottomCenterStatus",html:S.lab})			ob.colSpan = (S.tls.length - 2) 			S.fun(ob,i)			nDOMObj(row,"TD",{cls:"bottomRightStatus"});					}else{			nDOMObj(row,"TD",{cls:"middleLeft"}) 			if(i==0)for (j=1; j<S.tls.length;j++) var ob = nDOMObj(row,"td","","","","TCB","",S.tls[j],"&nbsp;");			else S.fun(row,i)						nDOMObj(row,"TD",{cls:"middleRight"})		}		}		return (alst[0])}function newFormObj(fLsi,ob,trg){	if(fLsi.H != undefined){			 ob.OSHideRule =  fLsi.H			 ob.style.visibility = "hidden"	}		fLsi.S = (fLsi.S == undefined ? "width:100%" : fLsi.S)	var OSEn = isNewDoc && fLsi.V== "" && fLsi.D != "" ? false : true	switch(fLsi.T){	case 10: // text inputline	case 11: // password		fLsi.O= nDOMObj(ob,"input",(fLsi.T == 10 ? "text":"password"),fLsi.N, (OSEn ? fLsi.V : fLsi.D),fLsi.N,"input","","",fLsi.S);					addTxtStdEvts(fLsi,ob,fLsi.O,false,false)			fLsi.O.OSFIdx =  ob.OSFIdx 		break;			case 17: // type ahead compo	case 15: // Combo style text entry		fLsi.O = nDOMObj(ob,"input","text",fLsi.N,OSEn ? fLsi.V :  fLsi.D,fLsi.N,"input","","",fLsi.S);			fLsi.O.autocomplete = 'off'			addTxtStdEvts(fLsi,ob,fLsi.O)			fLsi.O.OSFIdx =  ob.OSFIdx 		break;				case 20: // readonly		fLsi.O = ob		fLsi.O.OSEn = true		var ob1 = ob.appendChild( nDOMObj( null, "span", "", "", "", fLsi.N, "", "", fLsi.V ) );					break;			case 25: // image		fLsi.O = ob			break;			case 30: // file upload		if(document.OSFO == undefined) document.OSFO =[]		if(document.OSFI == undefined) document.OSFI =[]		fLsi.O = ob		fLsi.UPD = "PENDING"		ob.OSFidx = document.OSFI.length 		document.OSFI.push(fLsi)			document.OSFO.push(ob.OSFidx )		ob.uploadID = "" 			ob.doResponse = function (idx){			if( document.OSFI[idx].UPD.length==32){				this.uploadID = document.OSFI[idx].UPD				AjaxFormSave(this.arg1 ,this.arg2 , document.OSFI[idx].UPD)			}					}		ob.doUpload = function (ob,arg1, arg2){			this.arg1 = arg1			this.arg2 = arg2			var aob = document.OSFO[ob.O.OSFidx].forms[0]			for ( var i = 0; i <aob.childNodes.length;i++){				var vob = aob.childNodes[i]				if(aob.childNodes[i].tagName == "INPUT" && aob.childNodes[i].type == "file"){					if(vob.value == "") return false					ob.UPD = "SUBMITTED"					aob.submit()	;					return true				}			}		}		var ss = "<IFRAME id=upLoadForm  src='/" + trg + "/AJAXUpload?OpenForm&OSSEQ=" + ob.OSFidx  + "' onLoad='this.parentNode.parentNode.doResponse(" + ob.OSFidx  + ")' width=230 height=30 scrolling='no' frameborder=0></IFRAME>"		ob.fob = ob.appendChild(nDOMObj(null,"div","","","","","","",ss))		break;			case 40: // text area single paragraph	case 44: //  text area multi lines from picker	case 41: // text area multi lines		if(typeof(fLsi.D)  == "object" && isNewDoc ){			var s = fLsi.D[0]			for(var i = 1; i<fLsi.D.length; i++) s+= "\n" + fLsi.D[1]			fLsi.D =s		}		var ob1 = ob.appendChild(nDOMObj(null,"textarea","",fLsi.N,"",fLsi.N,"input","100%",OSEn ?  fLsi.V :  fLsi.D));		ob1.style.height =  fLsi.T == 35 ? "65px" : fLsi.T == 45 ? "45px"  :"85px"		addTxtStdEvts(fLsi,ob,ob1,false,false)			fLsi.O = ob1		break;				case 45:// rich text editor 		var ob1 = ob.appendChild(nDOMObj(null,"textarea","",fLsi.N,"",fLsi.N,"","100%",OSEn ?  fLsi.V :  fLsi.D));		fLsi.O = ob1		ob1.fLsi = fLsi 		return ob1							case 50 ://checkbox	case 51 ://single checkbox true false	case 60 ://radio verti	case 61 ://radio horiz	case 64 ://radio horiz yes no		fLsi.O =[];		var btype = fLsi.T <= 51 ? "checkbox" : "radio"		if( fLsi.T == 64 ) fLsi.P = "Yes|No".split("|")		var IEFix = ""		if(typeof (fLsi.P) == "object"){			for (var k = 0 ; k < fLsi.P.length; k++){								var ob1 = ob.appendChild(nDOMObj(null,"input",btype,fLsi.N,fLsi.T == 51? "true": fLsi.P[k],fLsi.N,"","","" ));				if((fLsi.V  != "" && fLsi.P[k] ==  fLsi.V) || ( fLsi.T == 51 && fLsi.V=="true")){ 					IEFix += "document.getElementsByName('"+ fLsi.N + "')[" + k + "].checked = true"					ob1.checked = true				};				fLsi.O.push(ob1)					if(typeof(fLsi.R) == "string")	newEvent(ob1,"onclick",fLsi.R )				else if(fLsi.R) newEvent(ob1,"onclick","w2Frm.w2fRefresh(" + ob.OSFIdx +")" )					var ob2 = ob.appendChild(nDOMObj(null,"label","","","","","","",fLsi.P[k] + ((fLsi.T == 60 || fLsi.T == 50 ) ? "<br/>" :"")));			}			}		fLsi.IEfix = IEFix 		break;			case 68 : // radio special		fLsi.O = ob	//	ob.innerHTML = fLsi.L + "<br/>"			if(fLsi.P1 != null  && fLsi.P2 != null) {			var tLst=newTable(ob)			for (var k = 0 ; k < fLsi.P1.length; k++){				var rob = tLst.appendChild(document.createElement("tr")) ; 				var tob =  rob.appendChild(nDOMObj(null,"TD","","","","","","30%",""));				var ob1 = tob.appendChild(nDOMObj(null,"input","radio",fLsi.N,fLsi.P1[k],fLsi.N,"","","" ));		// use onClick and not on change ... overcome known IE bug				newEvent(ob1,"onclick",	"var pn=this.parentNode.nextSibling;" +														"var ppn=this.parentNode.parentNode.parentNode;" +														"ppn.OSNode.style.fontWeight='normal';" +														"ppn.OSNode.style.textDecoration='none';" +  														"ppn.OSNode = pn;" + 																				 "pn.style.fontWeight='bold' ; " +  														 "pn.style.textDecoration='underline' ; "  )				//	if(fLsi.E != undefined) newEvent(ob1,"onclick",fLsi.E )							var ob2 = tob.appendChild(nDOMObj(null,"label","","","","","","",fLsi.P1[k] + "<br/>"));				var tob =  rob.appendChild(nDOMObj(null,"TD","","","","","","70%",fLsi.P2[k]));				if(fLsi.N,fLsi.P1[k] ==  fLsi.V ) {					ob1.checked = true					tLstOSNode = tob					tob.style.fontWeight='bold';					tob.style.textDecoration='underline';  				}			}					if(tLst.OSNode  == undefined && k > 0)	tLst.OSNode = tob			}					break				case 70 : // Number to two decimal places eg $n.nn		//	var ob1 = ob.appendChild(nDOMObj(null,"br"));					var ob1 = ob.appendChild(nDOMObj(null,"input","text",fLsi.N,isNewDoc ? fLsi.D :  fLsi.V,fLsi.N,"input","65px",""));						fLsi.O = ob1			addTxtStdEvts(fLsi,ob,ob1)				fLsi.O.OSFIdx = ob.OSFIdx 			break				case 80: // pick date					if(fLsi.V != undefined && fLsi.V != "") 				fLsi.P.push(fLsi.V)			var ob1 = ob.appendChild(nDOMObj(null,"input","text",fLsi.N,fLsi.V == "" ? fLsi.D :  fLsi.V,fLsi.N,"input","80px",""));				fLsi.O = ob1						addTxtStdEvts(fLsi,ob,ob1)				fLsi.O.OSFIdx =  ob.OSFIdx 							break;					case 86: //Date and time drop down		case 85: //Date and time slider			var fr = fLsi.P == undefined  ? 8 : fLsi.P[0]; 			var to = fLsi.P == undefined ? 17 : fLsi.P[1];							fLsi.P = [];			for	(var i=Math.floor(fr); i<=Math.floor(to);	i++) 	for(var j = i==Math.floor(fr) ?  Math.round((Math.abs(fr%1)*100*60)/100 ) : 0;    i == Math.floor(to) ? j<= Math.abs(to%1) * 15 :  j< 60 ; j+=15)	fLsi.P.push(exT(i,j))			var ob1 = ob.appendChild(nDOMObj(null,"input","text",fLsi.N,fLsi.V == "" ? fLsi.D :  fLsi.V,fLsi.N,"input","80px",""));				ob1.value = exT(Math.floor(fLsi.V), (fLsi.V - Math.floor(fLsi.V)) * 60	) 				fLsi.O = ob1			addTxtStdEvts(fLsi,ob,ob1)				fLsi.O.OSFIdx =  ob.OSFIdx 						break						}	return null		function exT (i,j){	return((i>12 ?  i-12 : i) + ":" + (j==0?"00":j)  + (i>11? " PM":" AM"));	}					function addTxtStdEvts(fLsi,ob,ob1){ // use for text and text areas		ob1.fLsi = fLsi				if(isNewDoc && fLsi.V== "" && fLsi.D != ""){			ob1.style.color = "#AAAAAA"			ob1.OSEn = false		}else			ob1.OSEn = true				if(typeof (fLsi.P) == "object"  || typeof (fLsi.P) == "function")			newEvent(ob1,"onfocus","pickObj.popPicker(this.fLsi);")			else{			newEvent(ob1,"onkeydown","return(doKeydown(event,this," + ob.OSFIdx + "," + fLsi.T +"));")				if(ob1.type=="text")				newEvent(ob1,"onfocus","if(! this.OSEn){this.OSEn  = true;this.style.color='black';this.value = '';}")			else				newEvent(ob1,"onfocus","if(! this.OSEn){this.OSEn  = true;this.style.color='black';this.innerHTML = '';}")		}	}}function getCoord(obj,top,left){	if(obj.length != undefined && obj.length >0 ) // is array then fisrt object	obj = obj[0]	var x = obj.offsetLeft 	if(!left) x+= obj.offsetWidth	var y = obj.offsetTop 	if(!top) y+= obj.offsetHeight	var parent = obj;	while (parent.offsetParent) {		parent = parent.offsetParent;	    	x += parent.offsetLeft;	    	y += parent.offsetTop;	}	return({x:x,y:y})}function getCursorPosition(e){    e = e || window.event;    var cursor = {x:0, y:0};    if (e.pageX || e.pageY){        cursor.x = e.pageX;        cursor.y = e.pageY;    }     else {        var de = document.documentElement;        var b = document.body;        cursor.x = e.clientX +             (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);        cursor.y = e.clientY +             (de.scrollTop || b.scrollTop) - (de.clientTop || 0);    }    return cursor;}function TosCookie(c_name,value,expiredays){ // this deletes created and read according to the args	if(value == undefined){		if (document.cookie.length>0)  {	  		c_start=document.cookie.indexOf(c_name + "=");	  		if (c_start!=-1) { 	    			c_start=c_start + c_name.length+1; 	    			c_end=document.cookie.indexOf(";",c_start);	    			if (c_end==-1) c_end=document.cookie.length;	    			return unescape(document.cookie.substring(c_start,c_end));			} 	  	}		return "";	}else{		var exdate=new Date();				exdate.setDate(exdate.getDate()+expiredays);		document.cookie=c_name+ "=" +escape(value)+((expiredays==undefined) ? "" : ";expires="+exdate.toGMTString() );		document.cookie=c_name+ "=" +escape(value)+((expiredays==undefined) ? "" : ";expires="+exdate.toGMTString() + ";domain=www.businessspectator.com");//		alert(document.cookie)	}}function IEBugFixes(){}