//THENMEDIA 2 - COPYRIGHT J. GUNSTONE 2011
//GLOBAL RUN

//define vars
var x1 = loadXML();
var x2 = loadXML();
var xr = false;
var xc = false;
var xd = false;
var mt;
var sv_ss2 = 0;
var sv_grp = 0;
var sv_ac1 = 0;
var tr_cls = 1;
var tr_opn = 1;
var tr1 = 0;
var tr2 = 0;
var tr3 = 0;
var ed1;
var ed2;
var ed3;
var can = '';
var bak = '';
var sv_fnc;
var st_fnc;
var sv_act;
var sv_id1;
var sv_id2;
var sv_id3;
var sv_tab = 0;
var trr_tid = new Array();
var trr_sta = new Array();
var pop_sta = false;
var sp_ac1 = null;

//block js errors
function noError(){return true;}
window.onerror = noError;

//build xml request
function loadXML() 
	{
	if (window.XMLHttpRequest) 
		{
		return new XMLHttpRequest();
		}
else if(window.ActiveXObject)
		{
		return new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
//run xml
function doXML(typ,fnc,act,id1,id2,id3)
	{
	//alert(typ+','+fnc+','+act+','+id1+','+id2+','+id3);	

	//save variables
	sv_act = act;
	sv_fnc = fnc;
	sv_id1 = id1;
	sv_id2 = id2;
	sv_id3 = id3;
	
	//loudhailer
	if(fnc == 16 && act == 1) 		{$('rt-16-1').set('html','contacting Facebook, please wait...');  id2 = $('so2').value;}
	else if(fnc == 16 && act == 2) {$('rt-16-2').set('html','contacting Twitter, please wait...'); id2 = $('so3').value;}

	//remember scrolling	
	if($('ss2t') != null) sv_ss2 = $('ss2t').scrollTop;	
	if($('grpt') != null && sv_grp == 0) sv_grp = $('grpt').scrollTop;	
	if(act == 1 && fnc > 3) {tr1 = 0; tr2 = 0; tr3 = 0;}
	
	//save tree
	if($('tre') != null)
		{
		trr_tre = $$('#tre ul'); 
		c1 = 0;
		while(c1 < trr_tre.length)
			{
			trr_tid.push(trr_tre[c1].get('id'));
			trr_sta.push(trr_tre[c1].getStyle('display'));
			c1 ++;
			}
		}
			
	//do function
	doLod(1);
	if(xr == false)
		{
		xr = true;
		if(typ == 'F' || typ == 'LF') 
			{		
			if(fnc < 10) fnm = 'F0'+fnc; else fnm = 'F'+fnc;		
			fld = $(fnm).toQueryString()+'&fnc='+fnc+'&act='+act+'&id1='+id1+'&id2='+id2+'&id3='+id3; 
			}
		else fld = 'fnc='+fnc+'&act='+act+'&id1='+id1+'&id2='+id2+'&id3='+id3;	
		x1.open("POST", '/function.js', true);
		x1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		x1.setRequestHeader("X-Requested-With", "XMLHttpRequest");
		x1.onreadystatechange = getXML;	
		x1.send(fld);
		if($('ac1') != null) $('ac1').setStyle('display','none');
		}
	else doLod(1);
	}

//get xml	
function getXML() 
	{	
	if (x1.readyState == 4) 
		{				
		if($('ac1') != null) $('ac1').setStyle('display','block');
		xr = false; xc = false;		
		if(sv_fnc < 100)
			{
			st_fnc = sv_fnc;
			if(bak == '') gt_res = x1.responseText;
			else {gt_res = bak; bak = '';}
			}
		else gt_res = x1.responseText;
		sp_res = gt_res;
		sp_res = sp_res.split('||S||');
		sp_sta = sp_res[0];
		if(sp_sta == 0) {} 			//no output
		else if(sp_sta > 0) 		//process output
			{			
			rt_fnc	=	sp_res[1];
			rt_res	=	sp_res[2];
			rt_clr		=	sp_res[3];
			rt_msg	=	sp_res[4];
			rt_mlv	=	sp_res[5];
			rt_htm	=	sp_res[6];
			rt_pop	=	sp_res[7];
			rt_jav	=	sp_res[8];
					
			//clear form
			if(rt_clr == 1) 
				{
				if(rt_fnc < 10) sp_cfm = 'F0'+rt_fnc; else sp_cfm = 'F'+rt_fnc;		
				$(sp_cfm).reset();
				}
		
			//messages
			if(rt_msg != '') 
				{
				if(top === self) doMsg(1,rt_msg,rt_mlv);
				else parent.doMsg(1,rt_msg,rt_mlv);
				}
				
			//plugin return
			if(rt_res == 1)
				{				
				//shop plugin
				if(rt_fnc == 123)
					{
					if($('bk1') != null) $('bk1').set('html',rt_htm);						
					if($('bk2') != null) 
						{
						rt_pop = rt_pop.split('|S|');
						if(rt_pop.length == 1) $('bk2').set('html',rt_pop);	
						else
							{
							$('prc').value = rt_pop[0];	
							$('vat').value = rt_pop[1];	
							$('bk2').set('html',rt_pop[2]);			
							$('bk3').set('html',rt_pop[3]);
							}
						}
					}
				
				//standard plugin
				else
					{	
					if(sp_sta > 1 && rt_jav == '') 	setTimeout("window.location.reload();",sp_sta);
					else if(sp_sta > 1) 					{setTimeout("window.location='"+rt_jav+"'",sp_sta); rt_jav = '';}		
					if(rt_jav != '') 							eval(rt_jav);								//return to function		
					if(rt_htm != '')	 						$(rt_pop).set('html',rt_htm);		//return to div
					}
				}
			
			//cloud return
			else if(rt_res > 1)
				{				
				if(sp_sta > 1) setTimeout("window.location.reload();",sp_sta);
				else
					{					
					if(rt_jav != '') 	eval(rt_jav);							//java function					
					if(rt_htm != '') 	$('rt1').set('html',rt_htm);		//return form
					if(can == '') 		can = gt_res;						//set cancel
					doSiz(siz);	
					
					//process actions
					if(rt_pop != '') 
						{
						rt_pop = rt_pop.split('|S|'); 
						if($('rt2') != null) $('rt2').set('html',rt_pop[0]);
						if(rt_pop[1] != '' && $('rt3') != null) $('rt3').set('html',rt_pop[1]);
						}
					
					//scroll pos
					if($('ss2t') != null) $('ss2t').scrollTop = sv_ss2;
					if($('grpt') != null) $('grpt').scrollTop = sv_grp;
	
					//editable areas
					if($('ed1') != null) doEdc(1);					
					if($('ed2') != null) doEdc(2);
					if($('ed3') != null) doEdc(3);
		
					//accordions
					if($('ac1') != null) new Fx.Accordion($('ac1'), '#ac1 .ach', '#ac1 .acc', {initialDisplayFx: false, alwaysHide: true, display: sv_ac1});
					if($('ac2') != null) new Fx.Accordion($('ac2'), '#ac2 .ach', '#ac2 .acc', {initialDisplayFx: false, alwaysHide: true, display: sv_ac1});
					if($('ac3') != null) new Fx.Accordion($('ac3'), '#ac3 .ach', '#ac3 .acc', {initialDisplayFx: false, alwaysHide: true, display: sv_ac1});
					if(sv_act > 1 && $('hsr') != null) $('hsr').setStyle('display','none'); else if($('hsr') != null) $('hsr').setStyle('display','block');
									
					//show actions		
					if($('rt2h') != null && $('rt2h').offsetHeight == 0 && sv_act == 2) rpn.display(0);

					//tabs			
					if(sv_act == 1) sv_tab = 0;					
					if($('nt1') != null) tab = new Tabs('nt1');					
										
					//tree menus
					if(rt_fnc == 31 || rt_fnc == 32 || rt_fnc == 51 || rt_fnc == 62 || rt_fnc == 63) {tr_cls = 1; tr_opn = 1;} else {tr_cls = 2; tr_opn = 2;}
					if($('tr1') != null && tr1 == 0) tr1 = new Tree('tr1'); 
					if($('tr2') != null && tr2 == 0) tr2 = new Tree('tr2');
					if($('tr3') != null && tr3 == 0) tr3 = new Tree('tr3');

					//recall tree
					if($('tre') != null && sv_act == 1 && trr_tid.length > 0)
						{						
						c1 = 0;
						while(c1 < trr_tid.length)
							{
							if($(trr_tid[c1]) != null && trr_sta[c1] == 'block') 
								{
								$(trr_tid[c1]).setStyle('display','block');
								}
							c1 ++;
							}
						trr_tid = new Array();
						trr_sta = new Array();
						}					
					
					//set link pool
					if($('scn') != null && $('scn').value > 0 && $('ed_bt7') != null) $('ed_bt7').set('html','<img src="/img/edi/ed7.png" id="ed_bt7i" title="Link pool" onclick="'+"window.open('/lb-7-"+sv_id1+".js','support','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=960,height=580')"+'" />');	
					if($('op2') != null) $('op2').addEvent('keydown:pause(240)', function() {doQln();} );
							
					//sortable
					if($('tre') != null && $('ord') != null) st1 = new Sortables($$('#tre ul'),{constrain: true, onSort: function(){$('ord').setStyle('display','block');}});		
					if($('ord') != null) $('ord').setStyle('display','none');							
					if($('tre') != null && $('rt3') != null) $('tre').style.height=(doBht() - 250)+'px';
					if($('trn') != null && $('rt3') != null) $('trn').style.height=(doBht() - 250)+'px';
					
					//log
					if($('rt-125-1') != null) setTimeout("doNot(0,'"+$('rt-125-id1').get('html')+"',"+$('rt-125-id2').get('html')+","+$('rt-125-id3').get('html')+");",20);
					
					//apps
					if($('aps') != null) setTimeout("doAps("+$('aps-per').get('html')+","+$('aps-pre').get('html')+");",20);

					//image picker
					if($('md1-s') != null) 
						{			
						doPic('md1',$('md1-m').get('value'),-1);
						$('md1-s').addEvent('keydown:pause(270)', function(){doPcl($('md1-p').get('value'),1,$('md1-m').get('value'));});
						}
					if($('md2-s') != null) 
						{			
						doPic('md2',$('md2-m').get('value'),-1);
						$('md2-s').addEvent('keydown:pause(270)', function(){doPcl($('md2-p').get('value'),1,$('md2-m').get('value'));});
						}
					}
				}	
												
			//grid return			
			if(rt_res == 3) 			{doXML('LF',rt_fnc,1,0,0,0);}
			else if(rt_res == 4) 	{setTimeout("doXML('LF',"+rt_fnc+",1,0,0,0);",200); doXML('LF',rt_fnc,6,sv_id1,0,0); }
			}	
		else
			{
			alert(sp_sta); //error
			}			
		doLod(0);	
		}
	}
	
//sort
function doSrt(tab)
	{
	var trs = $$('#tre span');
	c1 = 0;
	while(c1 < trs.length)
		{
		req = new Request({url:'/sort.js'});
		snd = 'tab='+tab+'&rec='+$(trs[c1]).get('id')+'&cnt='+(c1+1);
		req.send(snd);
		c1 ++;
		}
	if($('ord') != null) $('ord').setStyle('display','none');		
	}

//backup
function doCan(typ)
	{
	if(typ == 1) 
		{
		bak = can;
		bka = bak.split('||S||');
		bka[2] = 4;
		bak = bka.join('||S||');				
		sv_fnc = st_fnc;
		getXML();
		}
	}

//messaging
function doMsg(s,m,l)
	{
 	if(s == 1)
 		{
 		clearTimeout(mt);
 		t = true;
 		if(l == 5) {t == false; l = 4;} 		
 		if(l > 3) xc = true; 			
 		gl_mes.set('html', '<div id="lv'+l+'">'+m+'</div>'); 		
 		setTimeout("doMsg(2,0,0);",4000); 
 		sl_mes.slideIn();
 		if(t == true) mt = setTimeout("doMsg(2,0,0);",4000); 		
 		}
 	else
 		{
 		sl_mes.slideOut();
 		}
 	}

 //loading
 function doLod(s)
 	{
 	if(s == 1)
 		{
 		$$('.but').set('disabled',true);
 		gl_lod.set('html', '<img src="/img/gen/lod.gif"/>');
  		gl_lod.setStyle('display','block');  		
 		}
 	else
 		{
 		setTimeout("$$('.but').set('disabled',false);",1000);
 		setTimeout("gl_lod.setStyle('display','none');",200);
 		}
 	}
 	
 //popup
function doPop(url,wid,hig,scr)
	{
	if(scr > 1)
		{
		$('wsh').setStyle('display','block'); 
		if(scr == 3) scr = 1;
		else scr = 0;
		}
	if(url == 0) 	
		{
		pop_sta = false;
		gl_pwp.fade('out');			
		setTimeout("$('pwp').set('html','');",600);
		if($('wsh') != null) $('wsh').setStyle('display','none'); 		
		if($('nv_lft') != null) $('nv_lft').set('html','');
		if($('nv_rgt') != null) $('nv_rgt').set('html','');
		}
	else
		{
		pop_sta = true;
		tph = 0;
		if(scr == 1) scr = 'auto'; else scr = 'no';		
		if(hig > 300) tph = ' top:50%;'; else tph = ' top:30%;';
		if(url == 'bk1') url = '<div id="bk1"></div>';
		else url = '<iframe src="'+url+'" width="'+wid+'" height="'+hig+'" scrolling="'+scr+'" frameborder="0" marginheight="0" marginwidth="0"><p>Our website uses technology not supported by your internet browser</p></iframe>';
		$('pwp').set('html','<div id="pop" style="width:'+wid+'px;height:'+hig+'px;margin:-'+Math.round(hig / 2)+'px 0 0 -'+Math.round(wid / 2)+'px; '+tph+'"><div title="close this popup" onclick="doPop(0,0);" id="pcl"></div>'+url+'</div>');
		if(url == '<div id="bk1"></div>') doXML('L',123,0,0,0,0);
		gl_pwp.fade('in');	
		}
	}

//default
function doDef(nam,def)
	{
	if($(nam).get('value') == def) 
		{
		$(nam).set('value','');
		$(nam).set('styles',{color: '#222'});		
		}
	}
	
//date 	
function doDat(i)	
	{
	t = new Date()
	m = t.getMonth() + 1
	d = t.getDate()
	y = t.getFullYear()	
	b = new Array();	
	b[0] 	= $(i);
	c = 1;
	while(c < 6)
		{		
		b[c] = $(i+'-b'+c);	
		c ++;
		}	
			
	//error checking
	if(b[1].value == '') b[1].value = d;
	if(b[2].value == '') b[2].value = m;
	if(b[3].value == '') b[3].value = y;

	//set as ints
	b[1].value = +b[1].value;
	b[2].value = +b[2].value;
	b[3].value = +b[3].value;
	b[4].value = +b[4].value;
	b[5].value = +b[5].value;
		
	//val
	if(b[2].value > 12) b[2].value = '12';	
	if(b[1].value == 0) b[1].value = '01'; 
	if(b[2].value == 0) b[2].value = '01'; 	
	ly = ""+(b[3].value / 4);	
	ly = ly.indexOf('.');
	if(ly > 0 && b[2].value == 2 && b[1].value > 28) b[1].value = '28';
	else if(b[2].value == 2 && b[1].value > 29) b[1].value = '29';
	else if((b[2].value == 4 || b[2].value == 6 || b[2].value == 9 || b[2].value == 11) && b[1].value > 30)  b[1].value = '30';	
	else if(b[1].value > 30) b[1].value = '31';
	if(b[4].value > 23) b[4].value = '23';
	if(b[5].value > 59) b[4].value = '59';
		
	//add leading zeros
	if(b[1].value.length < 2) b[1].value = '0'+b[1].value;
	if(b[2].value.length < 2) b[2].value = '0'+b[2].value;
	if(b[3].value.length < 4) b[3].value = y;	
	if(b[4].value.length < 2) b[4].value = '0'+b[4].value;
	if(b[5].value.length < 2) b[5].value = '0'+b[5].value;
	
	//build date
	b[0].value = b[3].value+'-'+b[2].value+'-'+b[1].value+' '+b[4].value+':'+b[5].value+':00';	
	}	

//date time
function doDtm(nam)
	{
	if($(nam+'-tc').checked == true)
		{
		$(nam+'-b4').value='09';
		$(nam+'-b5').value='00';
		$(nam+'-hs').setStyle('visibility','visible'); 
		}
	else
		{
		$(nam+'-b4').value='01';
		$(nam+'-b5').value='01';
		$(nam+'-hs').setStyle('visibility','hidden'); 				
		}
	doDat(nam);	
	}

//options	
function addOp(sel,opt,val)
	{
	var nwo = new Option(opt,val);
	try
		{
		$(sel).add(nwo,null);
		}
	catch (err)
		{
		$(sel).add(nwo);
		}
	$(sel).value=val;
	}

//imgpic
function doPic(tig,mul,val)
	{
	val = val+'';
	pc1 = parent.document.getElementById(tig);
	pc2 = parent.document.getElementById(tig+'-c');	
	if(pc2 == null) pc2 = document.getElementById(tig+'-c');
	if(pc1 == null) pc1 = document.getElementById(tig);	
	if(val == 0) pc1.value = ''
	arr = pc1.value;
	arr = arr.split(',');
	if(arr.contains(val) == false && val > 0)
		{
		if(mul > 0 && arr.length >= mul) arr.erase(arr[0]);
		arr.include(val);
		}
	else
		{
		arr.erase(val);
		}
	res = arr.join(',');
	if(res.substring(0,1) == ',') res = res.substring(1);
	if(val > 0) pc1.value = res;
	
	//build display
	pc2.innerHTML = '';
	arr = res.split(','); c = 0;
	res = "";
	while(c < arr.length)
		{
		res = (res + '<a href="javascript:doPic(\''+tig+'\','+mul+','+arr[c]+');"><img width="84" class="sli" src="/med/Q'+arr[c]+'.jpg"/></a>');
		c ++;
		}
	if(res != '<a href="javascript:doPic(\''+tig+'\','+mul+',);"><img width="84" class="sli" src="/med/Q.jpg"/></a>') pc2.innerHTML = res+'<div class="clr"></div>';
	}
function doPcl(pro,tig,mul)
	{
	ser = $('md'+tig+'-s').get('value');
	gal = $('md'+tig+'-g').getElement(":selected").value;
	lab = $('md'+tig+'-g').getElement(":selected").text;
	ttl = $('ttl').get('value');
	if(ser == '') ser = 'none';	
	if(lab == 'Suggestions' && gal == 0 && ttl != '') ser = ttl;
	url = '/ip-'+pro+'-'+tig+'-'+mul+'-'+gal+'-'+ser+'.js';
	if(ser.length > 2) $('md'+tig+'-i').setProperty('src',url);
	}
	
//word count
function doWC(sty,ele,max)
	{
	txt = $(ele).value;
	
	//character count
	if(sty == 1)
		{
		cnt = txt.length;
		if(max > 0) res = cnt+' / '+max;
		else res = cnt;
		}
	//word count
	else if(sty == 2)
		{
		cnt = txt.length;
		if(max > 0) res = cnt+' / '+max;
		else res = cnt;
		}		
		
	//max reached	
	if(cnt > max && max > 0) $(ele).setStyle('color','#BE1719');
	else $(ele).setStyle('color','#111');		
	$(ele+'-i').set('html',res);	
	}
		
//fold
function doFld(fld)
	{
	flv = new Fx.Slide('fld'+fld);
    flv.toggle();
	}

//changed field
function doChn()
	{
	xc = true;
	}

//keyboard mapper
function doKey(obj)
	{
	var fot = obj;
	if(document.createEvent)
		{
	  	var evo = document.createEvent('MouseEvents');
	  	evo.initEvent( 'click', true, false);
	  	fot.dispatchEvent(evo);
		} 
	else if(document.createEventObject) fot.fireEvent('onclick');
	}

//do affiliates
function doAff(act,flt,swt,val)
	{
	$$('.acl').removeClass('acv');
	fld = 'fnc=194&act='+act+'&id1='+flt+'&id2='+swt+'&id3='+val;
	x2.open("POST", '/function.js', true);
	x2.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	x2.setRequestHeader("X-Requested-With", "XMLHttpRequest");
	x2.onreadystatechange = gtAff;	
	x2.send(fld);	
	}
function gtAff()
	{
	if(x2.readyState == 4) 
		{
		res = x2.responseText;	
		if(res != '')
			{
			res = res.split('||S||');
			if(res[4] != '' && res[5] > 0) setTimeout("doMsg(1,'"+res[4]+"',"+res[5]+");",1000);
			}
		if($('rt-193-1') != null) setTimeout("doXML('L',193,1,"+$('rt-193-1').get('data-snd1')+","+$('rt-193-1').get('data-snd2')+","+$('rt-193-1').get('data-snd3')+")",50);
		}
	}

//moo tools
window.addEvent('domready', function(){
$(document.body).set('html',$(document.body).get('html')+'<div id="lod"></div><div id="mes"></div><div id="pwp"></div><div id="nv_lft" class="nvg" style="left:16px;"></div><div id="nv_rgt" class="nvg" style="right:16px;"></div>');	

//keyboard shortcuts
var kbd = new Keyboard({events: 
	{
	'keyup:esc': ky1,
	'keydown:meta+b': ky2,'keydown:ctrl+b': ky2,
	'keydown:meta+i': ky3,'keydown:ctrl+i': ky3,
	'keydown:meta+h': ky4,'keydown:ctrl+h': ky4,	
	'keydown:s': ky5,
	'keydown:left': ky6,
	'keydown:right': ky7,
	'keydown:n': ky8	
	}
});
kbd.activate();
function ky1()
	{
	if($('pcl') != null && $('pcl').getStyle('visibility') == 'visible') doKey($('pcl'));
	else if($('kc2') != null) doKey($('kc2')); 
	else if($('kc1') != null) doKey($('kc1')); 
	}
function ky2(){if($('ed_bt2') != null) doKey($('ed_bt2'));}
function ky3(){if($('ed_bt3') != null) doKey($('ed_bt3'));}
function ky4(){if($('ed_bt6') != null) doKey($('ed_bt6'));}
function ky5()
	{
	eak = document.activeElement;	
	if(eak.get('id') == null && sv_act == 1 && srf == false && $('ss1') != null) 
		{
		srf = true;
		rpn.display(1);
		setTimeout("$('ss1').focus();doDef('ss1','search for...');",200);	
		}
	}
function ky6()
	{
	if($('kc3') != null && $('pan') == null)
		{
		eak = document.activeElement;
		if(eak.get('id') == null) doKey($('kc3'));
		}
	}
function ky7()
	{
	if($('kc4') != null && $('pan') == null)
		{
		eak = document.activeElement;
		if(eak.get('id') == null) doKey($('kc4'));		
		}
	}
function ky8()
	{
	eak = document.activeElement;
	if(eak.get('id') == null && $('kc5') != null && sv_act == 1) doKey($('kc5'));
	}

//map
if($('map') != null) map();

//public accordion
if($('ac4') != null) new Fx.Accordion($('ac4'), '#ac4 .ach', '#ac4 .acc', {initialDisplayFx: false, alwaysHide: true, display:-1});
if($('ac5') != null) new Fx.Accordion($('ac5'), '#ac5 .ach', '#ac5 .acc', {initialDisplayFx: false, alwaysHide: true, display:0});

//add options
if($('nv1') != null) 	var nv1 = new UvumiDropdown('nv1');
if($('nv2') != null) 	var nv2 = new UvumiDropdown('nv2',{mode:'vertical'});
if($('bk2') != null) setTimeout("doXML('L',123,0,0,0,0);",20);
if($('rt-122-1') != null) setTimeout("doXML('L',122,0,0,0,0);",20);
if($('rt-108-1') != null) setTimeout("doXML('L',108,0,0,0,0);",20);

//add affiliates
if($('rt-191-1') != null || $('rt-192-1') != null || $('rt-193-1') != null) setTimeout("doAff(1,0,0,0)",20);

//add slide
if($('sld') != null) 
	{
	var sld = new slideGallery($('sld'),{
	steps: 1,
	autoplay: true,
	mode: 'circle',
	duration: 3500,
	onPlay: function() {this.fireEvent("start");}});
	}
	
//hide sct
if(top !== self && $('sct') != null) $('sct').setStyle('display','none');

//setup globals
gl_lod = $('lod');
gl_mes = $('mes');
sl_mes = new Fx.Slide('mes');
gl_mes.set('html','&nbsp;');
sl_mes.slideOut();
gl_pwp = $('pwp'); gl_pwp.fade('out');
sp_unm = $('unm'); if(sp_unm) sp_unm.focus();
});
