var abc=" !\"#$%_'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~_?__";
function decodeurl(str){
	var res="";
	var n;
	for(var i=0;i<str.length;i++){
		var c=str.substr(i,1);
		if(c=="+"){
			res+=" ";
		}else if(c=="%"){
			var asc=parseInt(str.substr(i+1,2),16);
			if(asc>=32)res+=abc.substr(asc-32,1);
			i+=2;
		}else{
			res+=c;
		}
	}
	return res;
}
function encodeurl(str){
	var res="";
	var iii=0;
	for(var i=0;i<str.length;i++){
		var c=str.substr(i,1);
		if(c==" "){
			res+="+";
		}else if((c>="A"&&c<="Z")||(c>="a"&&c<="z")||(c>="0"&&c<="9")||("-_.~/?=&:".indexOf(c)>=0)){
			res+=c;
		}else{
			var n=abc.indexOf(c);
			if(n>=0){
				res+="%"+(n+32).toString(16);
			}
		}
	}
	return res;
}
function getCookieI(n){
	var s=getCookie(n);
	if(s==null) return 0;
	if(isNaN(s)) return 0;
	return parseInt(s);
}
function getCookie(n){
	var s=document.cookie.indexOf(n+'=');
	var l=s+n.length+1;
	if((!s)&&(n!=document.cookie.substring(0,n.length))) return null;
	if(s==-1){return null;}
	var e=document.cookie.indexOf(';',l);
	if(e==-1){e=document.cookie.length;}
	return unescape(document.cookie.substring(l,e));
}
function setCookie(n, v, d){
	var t=new Date();
	t.setTime(t.getTime());
	var e=new Date(t.getTime()+(d*86400000));
	document.cookie=n+'='+escape(v)+';expires='+e.toGMTString();
}
function addEventHandler(obj,event,handler){
	if(obj["addEventListener"]){
		obj.addEventListener(event, handler, false);
	}else if(obj["attachEvent"]){
		obj.attachEvent('on'+event, handler);
	}
}
function removeEventHandler(obj,event,handler){
	if(obj["removeEventListener"]){
		obj.removeEventListener(event, handler, false);
	}else if(obj["detachEvent"]){
		obj.detachEvent('on'+event, handler);
	}
}
function getElementOffset(elem){
	var x=0;
	var y=0;
	while(elem!=null){
		x+=elem.offsetLeft;
		y+=elem.offsetTop;
		elem=elem.offsetParent;
	}
	return{x:x,y:y};
}
function scrollToElement(elem){
	var ofs=getElementOffset(elem);
	window.scrollTo(ofs.x,ofs.y);
}
function getPageHeightWithScroll(w){
	var cn=w.document.body.childNodes;
	var h=35;
	for(var i=0;i<cn.length;i++){
		var c=cn[i];
		var d=c["style"]?c.style["display"]:"";
		if((!d||d=="block")&&(!c.id||(c.id!="shield"&&c.id.substr(0,3)!="mce"))){
			h+=c.scrollHeight||0;
		}
	}
	document.ifrHeigth=h;
	return h;
}
function changeCSSRule(w,selText,elem,val){
	if(!w.document["styleSheets"]){
		return;
	}
	var st=w.document.styleSheets[0];
	var rules=st["cssRules"]?st.cssRules:st.rules;
	for(var i=0;i<rules.length;i++){
		if(rules[i].selectorText==selText){
			rules[i].style[elem]=val;
			return true;
		}
	}
	return false;
}
function windowHeight(){
	var h=0;
	if(typeof(window['innerHeight'])=='number'){
		h=window.innerHeight;
	}else if(document['documentElement']&&(document.documentElement['clientHeight'])){
		h=document.documentElement.clientHeight;
	}else{
		h=document.body.clientHeight;
	}
	return h;
}
function getXmlHttp(){
  var xmlhttp;
  try {
	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e){
	try {
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E){
	  xmlhttp=false;
	}
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined'){
	xmlhttp=new XMLHttpRequest();
  }
  return xmlhttp;
}
function defMousePosition(event,w){
	var x=y=0;
	if(w){
		var fr=document.getElementsByTagName("iframe");
		if(fr){
			for(var i=0;i<fr.length;i++){
				if(fr[i].contentWindow==w){
					var ofs=getElementOffset(fr[i]);
					x=ofs.x;
					y=ofs.y;
					break;
				}
			}
		}
	}else{
		w=window;
	}
	if(w.event&&w.document.documentElement&&w.document.body){
		x+=w.event.clientX+w.document.documentElement.scrollLeft+w.document.body.scrollLeft;
		y+=w.event.clientY+w.document.documentElement.scrollTop+w.document.body.scrollTop;
	}else{
		x+=event.clientX+w.scrollX;
		y+=event.clientY+w.scrollY;
	}
	return{x:x,y:y};
}
function showMsgWnd(b,n){
	if(!document._userName)return;
	document.getElementById('usermailwnd').style.display=b?'':'none';
	if(b){
		document.getElementById('userinfo').style.display='none';
		info=false;
		tinyMCE.init(tinyMCEParams('umailtxtId'));
		if(n){
			document.getElementById('mailForm').userName.value=n;
		}
	}
}
function addRow(cell1,cell2){
	var tr,td;
	var table=document.getElementById("infotable");
	tr=table.insertRow(table.rows.length);
	td=tr.insertCell(0);
	td.width='110px';
	td.innerHTML=cell1;
	td=tr.insertCell(1);
	td.innerHTML=cell2;
	return 1;
}
function setShield(b){
	document.getElementById("shield").style.display=b?"":"none";
}
function windowSize(){
	var w=0,h=0;
	if(typeof(window['innerWidth'])=='number'){
		w=window.innerWidth;
		h=window.innerHeight;
	}else if(document['documentElement']&&(document.documentElement['clientWidth'])){
		w=document.documentElement.clientWidth;
		h=document.documentElement.clientHeight;
	}else{
		w=document.body.clientWidth;
		h=document.body.clientHeight;
	}
	return{w:w,h:h};
}

function adjustImgSize(img,maxW,maxH,continuation){
	if(!img.complete){
		setTimeout(function(){adjustImgSize(img,maxW,maxH,continuation);},50);
		return;
	}
	if(!img.width||!img.height){
		return;
	}
	var w=maxW||150;
	var h=maxH||maxW||150;
	var dx=w/img.width;
	var dy=h/img.height;
	if((dx<1)||(dy<1)){
		if(dx>dy){
			w=img.width*dy;
		}else{
			h=img.height*dx;
		}
		img.width=w;
		img.height=h;
	}
	img.style.position="static";
	if(continuation){
		continuation();
	}
}
function replaceQuotes(s){
	return s.replace(/'/g,"\\'").replace(/&#39;/g,"\\'").replace(/"/g,"&quot;");
}
function printPlayComp(url,prfm_name,cmp_name){
	return 'playComp(\''+url+'\',\''+replaceQuotes(prfm_name)+'\',\''+replaceQuotes(cmp_name)+'\',event)';
}
function stopPropagation(e){
	if(!e)e=window.event;
	e.cancelBubble=true;
	if(e.stopPropagation)e.stopPropagation();
}
function removeChildrenFromNode (node){
	while(node.childNodes.length >=1 ){
	   node.removeChild(node.firstChild);
	}
}
function getNumById(mas,id,n){
	if(!n){
		n=0;
	}
	for(var i=0;i<mas.length-1;i++){
		if(mas[i][n]==id){
			return i;
		}
	}
	return -1;
}
function trim(s){
	var l=0;
	var r=s.length-1;
	while(l<s.length&&s[l]==' '){
		l++;
	}
	while(r>l&&s[r]==' '){
		r--;
	}
	return s.substring(l,r+1);
}
function setRadioButtonValue(radioObj,newValue){
	for(var i=0;i<radioObj.length;i++){
		radioObj[i].checked=false;
		if(radioObj[i].value==newValue){
			radioObj[i].checked=true;
		}
	}
}
function setRadioButtonDisabled(radioObj,isDisabled){
	for(var i=0;i<radioObj.length;i++){
		radioObj[i].disabled=isDisabled;
	}
}
function isParentOf(parent,child){
	while(child){
		if(child==parent){
			return true;
		}
		child=child.parentNode;
	}
	return false;
}
function maxLength(field,maxChars){
	if(field.value.length>maxChars){
		field.value=field.value.substr(0,maxChars);
	}
}
function initCountryOptions(countryOptionsId,existingAlbumsOnly){
	var countryOptions=document.getElementById(countryOptionsId);
	var n=1;
	for(var i=0;i<document._allCountriesOrder.length-1;i++){
		var id=document._allCountriesOrder[i];
		var cntry=document._allCountries[id];
		if(!existingAlbumsOnly||cntry[1]){
			countryOptions.options[n]=new Option(cntry[0],id);
			n++;
		}
	}
}
function tinyMCEParams(id,lang){
    return {
        mode:'exact',  
        elements:id,
        theme:'advanced',
        plugins:'inlinepopups,smiles',
        theme_advanced_buttons1:'bold,italic,underline,strikethrough,|,forecolor,backcolor,|,smiles',
        theme_advanced_buttons2:'',
        theme_advanced_buttons3:'',
        theme_advanced_toolbar_location:'top',
        theme_advanced_toolbar_align:'left',
        theme_advanced_resizing:false,
        strict_loading_mode:true,
        translate_mode:true,
        force_br_newlines:true,
        forced_root_block:'',
        handle_event_callback:'keyListener',
        language:lang
    };
}
function onContent(i){var u =navigator.userAgent;var e=/*@cc_on!@*/false; var st =
setTimeout;if(/webkit/i.test(u)){st(function(){var dr=document.readyState;
if(dr=="loaded"||dr=="complete"){i()}else{st(arguments.callee,10);}},10);}
else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
document.addEventListener("DOMContentLoaded",i,false); } else if(e){     (
function(){var t=document.createElement('doc:rdy');try{t.doScroll('left');
i();t=null;}catch(e){st(arguments.callee,0);}})();}else{window.onload=i;}}
function oneSmile(mainURL,imgNo,imgTitle){
    return '<img border="0" src="'+mainURL+'images/tiny_mce/plugins/smiles/img/'+imgNo+'.gif" title="'+imgTitle+'">';
}
function replaceSmiles(s,mainURL){
    if(s.search(/O:-\)/)!=-1){
        var cont=s.replace(/O:-\)/gi,oneSmile(mainURL,'0301','O:-)'));
        return catSmiles(cont,mainURL);
    }
    var cont=s
        .replace(/\*JOKINGLY\*/gi,oneSmile(mainURL,'0126','*JOKINGLY*'))
        .replace(/\*KISSED\*/gi,oneSmile(mainURL,'0331','*KISSED*'))
        .replace(/\*TIRED\*/gi,oneSmile(mainURL,'0159','*TIRED*'))
        .replace(/\*STOP\*/gi,oneSmile(mainURL,'0515','*STOP*'))
        .replace(/\*KISSING\*/gi,oneSmile(mainURL,'0314','*KISSING*'))
        .replace(/\*THUMBS UP\*/gi,oneSmile(mainURL,'0134','*THUMBS UP*'))
        .replace(/\*DRINK\*/gi,oneSmile(mainURL,'0908','*DRINK*'))
        .replace(/\*IN LOVE\*/gi,oneSmile(mainURL,'0311','*IN LOVE*'))
        .replace(/\*HELP\*/gi,oneSmile(mainURL,'0927','*HELP*'))
        .replace(/\*OK\*/gi,oneSmile(mainURL,'0135','*OK*'))
        .replace(/\*WASSUP\*/gi,oneSmile(mainURL,'1812','*WASSUP*'))
        .replace(/\*SORRY\*/gi,oneSmile(mainURL,'0241','*SORRY*'))
        .replace(/\*BRAVO\*/gi,oneSmile(mainURL,'0131','*BRAVO*'))
        .replace(/\*ROLF\*/gi,oneSmile(mainURL,'0119','*ROLF*'))
        .replace(/\*PARDON\*/gi,oneSmile(mainURL,'0231','*PARDON*'))
        .replace(/\*NO\*/gi,oneSmile(mainURL,'0507','*NO*'))
        .replace(/\*CRAZY\*/gi,oneSmile(mainURL,'0204','*CRAZY*'))
        .replace(/\*DONT_KNOW\*/gi,oneSmile(mainURL,'0228','*DONT_KNOW*'))
        .replace(/\*DANCE\*/gi,oneSmile(mainURL,'0139','*DANCE*'))
        .replace(/\*YAHOO\*/gi,oneSmile(mainURL,'0133','*YAHOO*'))
        .replace(/\*HI\*/gi,oneSmile(mainURL,'0612','*HI*'))
        .replace(/\*BYE\*/gi,oneSmile(mainURL,'0103','*BYE*'))
        .replace(/\*YES\*/gi,oneSmile(mainURL,'0114','*YES*'))
        .replace(/\*WALL\*/gi,oneSmile(mainURL,'1243','*WALL*'))
        .replace(/\*WRITE\*/gi,oneSmile(mainURL,'1106','*WRITE*'))
        .replace(/\*SCRATCH\*/gi,oneSmile(mainURL,'0225','*SCRATCH*'))
        .replace(/@=/gi,oneSmile(mainURL,'0519','@='))
        .replace(/@}-&gt;--/gi,oneSmile(mainURL,'0323','@}-&gt;--'))
        .replace(/:-\*/gi,oneSmile(mainURL,'0332',':-\*'))
        .replace(/:-\(/gi,oneSmile(mainURL,'0235',':-('))
        .replace(/:\(/gi,oneSmile(mainURL,'0235',':('))
        .replace(/=\(/gi,oneSmile(mainURL,'0235','=('))
        .replace(/:\'\(/gi,oneSmile(mainURL,'0242',':\'('))
        .replace(/:-\)/gi,oneSmile(mainURL,'0101',':-)'))
        .replace(/:\)/gi,oneSmile(mainURL,'0101',':)'))
        .replace(/=\)/gi,oneSmile(mainURL,'0101','=)'))
        .replace(/;\)/gi,oneSmile(mainURL,'0129',';)'))
        .replace(/;-\)/gi,oneSmile(mainURL,'0129',';-)'))
        .replace(/%-\)/gi,oneSmile(mainURL,'0210','%-)'))
        .replace(/%\)/gi,oneSmile(mainURL,'0210','%)'))
        .replace(/8-\)/gi,oneSmile(mainURL,'0407','8-)'))
        .replace(/:-D/gi,oneSmile(mainURL,'0123',':-D'))
        .replace(/:D/gi,oneSmile(mainURL,'0123',':D'))
        .replace(/;D/gi,oneSmile(mainURL,'0128',';D'))
        .replace(/:-X/gi,oneSmile(mainURL,'0221',':-X'))
        .replace(/:-x/gi,oneSmile(mainURL,'0221',':-x'))
        .replace(/:-!/gi,oneSmile(mainURL,'0216',':-!'))
        .replace(/:!/gi,oneSmile(mainURL,'0216',':!'))
        .replace(/\[:-}/gi,oneSmile(mainURL,'0924','[:-}'))
        .replace(/:-\[/gi,oneSmile(mainURL,'0305',':-['))
        .replace(/:\[/gi,oneSmile(mainURL,'0305',':['))
        .replace(/&gt;:o/gi,oneSmile(mainURL,'0509','>:o'))
        .replace(/=-O/gi,oneSmile(mainURL,'0206','=-O'))
        .replace(/=O/gi,oneSmile(mainURL,'0206','=O'))
        .replace(/:-O/gi,oneSmile(mainURL,'0206',':-O'))
        .replace(/:O/gi,oneSmile(mainURL,'0206',':O'))
        .replace(/:-P/gi,oneSmile(mainURL,'0851',':-P'))
        .replace(/:-\|/gi,oneSmile(mainURL,'0516',':-|'))
        .replace(/:-\\/gi,oneSmile(mainURL,'0151',':-\\'))
        .replace(/\\m\//gi,oneSmile(mainURL,'0439','\\m/'))
        .replace(/:-\//gi,oneSmile(mainURL,'0151',':-/'))
        .replace(/]:-&gt;/gi,oneSmile(mainURL,'0520',']:->'));
    return cont;
}
function catSmiles(s,mainURL){
    var ret='',sb=s;
    var pos;
    do{
        pos=sb.search(/\</gi);
        if(pos==-1)pos=sb.length;
        ret+=replaceSmiles(sb.substr(0,pos),mainURL);
        sb=sb.substr(pos);
        pos=sb.search(/\>/gi)+1;
        ret+=sb.substr(0,pos);
        sb=sb.substr(pos);
    }while(sb!='');
    return ret;
}
function initTinyMCE(id,lang){
    if(((navigator.userAgent.indexOf('Chrome')>=0)&&(navigator.userAgent.indexOf('Windows')>=0))||!id||(id==''))return;
    tinyMCE.init(tinyMCEParams(id,lang));
}