
var ratingblock = false;
var zoomed = false;
	
var Org_flashWidth = "574";
var Org_flashHeight = "480";
var Exp_flashWidth = "818";
var Exp_flashHeight = "536";
var storewidth = 0;
var VFavstatus = 'none';
var PFavstatus = 'none';


function showPreview(obj,ani){
	if(ani.indexOf(".gif")!=-1){
		obj._tmp=obj.src;
		obj.src=ani;
	}
}

function hidePreview(obj){
	if(obj._tmp){
		obj.src=obj._tmp;
	}
}

function getFlash(movieName) 
				{
					if (navigator.appName.indexOf ("Microsoft") !=-1) {
    				return window[movieName];
  				} else {
   					return window.document[movieName];
  				}
				}

function MenuOn(zoom){
	
	Zoom('leftmenu','flashbox',zoom);
	
}

function gotoUrl(gURL){
	
	location.replace(gURL);
	
}


function Expand(){
	getFlash('flvplayer').style.width = Exp_flashWidth + "px";
	getFlash('flvplayer').style.height = Exp_flashHeight + "px";
	$('flashheadline').className = 'BgHeadfullx32';
	storewidth = $('rightcontent').style.width;
	$('rightcontent').style.width =  (Number(Exp_flashWidth) + 20) +"px"; 
}

function Zoom(objdisable,objexpand,zoom){

	if(zoom == false){
	
	 if (navigator.userAgent.indexOf("Safari") == -1) { 
  	func=Effect.Fade;
	}else{
		func=Effect.BlindUp;
	}

	new Effect.Parallel([
  
  func($(objdisable),
    { duration: 0.7 }
  )
 
 ], {afterFinish:Expand});
	
	}else{
	
	getFlash('flvplayer').style.width = Org_flashWidth+ "px";
	getFlash('flvplayer').style.height = Org_flashHeight  + "px";

	$('flashheadline').className = 'BgHead578x32';
	$('rightcontent').style.width = (Number(Org_flashWidth) + 17) +"px"; 
  if (navigator.userAgent.indexOf("Safari") == -1) { 
  	Effect.Appear($(objdisable));
	}else{
		Effect.BlindDown($(objdisable));
	}
	}


}



function overRating(over,mode,start){
	
	if(ratingblock == false){
	
			if(mode == 'over'){
			
			srcurl = imgURL+"/Pages/Icons/star_big_on.gif";
				
			}else{
			
			srcurl = imgURL+"/Pages/Icons/star_big_off.gif";
			
			}
			
			for(i=1;i <= over;i++){
				
				switch(mode){
					case "out":
					
					if(i <= start){
						srcurl = imgURL+"/Pages/Icons/star_big_on.gif";
					}else{
						srcurl = imgURL+"/Pages/Icons/star_big_off.gif";
					}
				
						$('r_'+i).src = srcurl;

					case "over":
					
					$('r_'+i).src = srcurl;
					
					break;
				}

			}
	
	}
	
}

function CheckVoucher(Voucher){

	$('vouchervalue').disabled = true;
	$('info').innerHTML =	vouchertexte['start'];
	
		new Ajax.Request('/tube/Remote_Payment.checkVoucher?noframe=1&voucher='+escape(Voucher)+'&time='+Date.parse(),  {
		method:'post',
		onSuccess: function(transport){       

		checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Coins');
		
		
    if(transport.responseXML.getElementsByTagName('error')[0].firstChild.nodeValue == "false"){
		
		tmptext = vouchertexte['gutscheinok'];
		coins = transport.responseXML.getElementsByTagName('coins')[0].firstChild.nodeValue;
		
		$('gutschein').innerHTML = tmptext.replace(/{COINS}/g, coins);
		new Effect.Highlight('maingutschein', {startcolor:'#669900', restorecolor:''});
		
	}else{
	
	$('vouchervalue').disabled = false;
	$('info').innerHTML = vouchertexte[transport.responseXML.getElementsByTagName('information')[0].firstChild.nodeValue];
	
	new Effect.Highlight('maingutschein', {startcolor:'#FF6C6C', restorecolor:''});
	}
		 
		 }
		 ,     
		 
		onFailure: function(){ 
		
		$('vouchervalue').disabled = false;
		$('info').innerHTML = vouchertexte['fehler'];
		new Effect.Highlight('maingutschein', {startcolor:'#FF6C6C', restorecolor:''});
		}   
	}
	
	); 
	
	
}



function SendComment(obj,usrid){
	 
	 obj = $(obj);

	if(obj.value.length > 2){
	
	$('CommentText').disabled = true;
	$('ProfilKommentarInfo').innerHTML =	votetexte['start'];
		
	new Ajax.Request('/tube/Remote_Profil.setComment?noframe=1&text='+escape(obj.value)+'&usrid='+usrid,  {
		method:'post',
	onSuccess: function(transport){       
    
    checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Profil/'+usrid);
    
    returnVal = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;

    if(returnVal == 'COMMENTOK'){
    	
    	$('ProfilKommentarInfo').innerHTML = votetexte[returnVal];
    	new Effect.Highlight('comment', {startcolor:'#669900', restorecolor:''});
    	ajaxtab('/tube/tab.ProfilKommentare/'+usrid+'?noframe=1', 'ProfilKommentar');
    	$('CommentText').value = '';
    	
    }else{
    
	    $('CommentText').disabled = false;
	    $('ProfilKommentarInfo').innerHTML = votetexte[returnVal]
	    new Effect.Highlight('comment', {startcolor:'#FF6C6C', restorecolor:''});
	    
  	}
    
		
		 }
		 ,     
		 
		onFailure: function(){ 
		
		$('ProfilKommentarInfo').innerHTML = votetexte['COMMENTNOKTEXT']
		new Effect.Highlight('comment', {startcolor:'#FF6C6C', restorecolor:''});
		}   
	}
	
	); 
	

	}else{
		$('ProfilKommentarInfo').innerHTML = votetexte['COMMENTNOKTEXT']
		new Effect.Highlight('comment', {startcolor:'#FF6C6C', restorecolor:''});
	}
	
}

function SendVideoComment(obj,vid){
	 
	 obj = $(obj);

	if(obj.value.length > 2){
	
	$('CommentText').disabled = true;
	$('VideoKommentarInfo').innerHTML =	votetexte['start'];
		
	new Ajax.Request('/tube/Remote_Video.setComment?noframe=1&text='+escape(obj.value)+'&vid='+vid,  {
		method:'post',
	onSuccess: function(transport){       
    
    
    checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Video/'+vid);
    

    returnVal = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;


    if(returnVal == 'COMMENTOK'){
    	
    	$('VideoKommentarInfo').innerHTML = votetexte[returnVal];
    	new Effect.Highlight('comment', {startcolor:'#669900', restorecolor:''});
    	ajaxtab('/tube/tab.VideoKommentare/'+vid+'?noframe=1', 'VideoKommentar');
    	$('CommentText').value = '';
    	
    }else{
    
	    $('CommentText').disabled = false;
	    $('VideoKommentarInfo').innerHTML = votetexte[returnVal]
	    new Effect.Highlight('comment', {startcolor:'#FF6C6C', restorecolor:''});
	    
  	}
    
		
		 }
		 ,     
		 
		onFailure: function(){ 
		
		$('VideoKommentarInfo').innerHTML = votetexte['COMMENTNOKTEXT']
		new Effect.Highlight('comment', {startcolor:'#FF6C6C', restorecolor:''});
		}   
	}
	
	); 
	

	}else{
		$('VideoKommentarInfo').innerHTML = votetexte['COMMENTNOKTEXT']
		new Effect.Highlight('comment', {startcolor:'#FF6C6C', restorecolor:''});
	}
	
}


function ProfilSetCoComment(obj,komid){
	 obj = $(obj);
	
	
	if(obj.value.length > 2){
	
	$('CommentText'+komid).disabled = true;
	$('CommentTextArea'+komid).innerHTML =	votetexte['start'];
	
	new Ajax.Request('/tube/Remote_Profil.setCoComment?noframe=1&text='+escape(obj.value)+'&kom_id='+komid,  {
		method:'post',
		onSuccess: function(transport){       
	
	    checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Video/'+vid);
	    returnVal = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;
	    
			$('CommentTextArea'+komid).innerHTML = votetexte[returnVal];
			 },     
		onFailure: function(){ 
			$('CommentText'+komid).disabled = false;
			$('CommentTextArea'+komid).innerHTML = votetexte['COMMENTNOK'];
			
			}   
	}
	
	); 
	
	}
	
}

function VideoSetCoComment(obj,komid,vidid){
	 obj = $(obj);
	
	
	if(obj.value.length > 2){
	
	$('CommentText'+komid).disabled = true;
	$('CommentTextArea'+komid).innerHTML =	votetexte['start'];
	
	
	new Ajax.Request('/tube/Remote_Video.setCoComment?noframe=1&text='+escape(obj.value)+'&kom_id='+komid+'&vidid='+vidid+'&',  {
		method:'post',
		onSuccess: function(transport){       
    
    checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Video/'+vid);
    returnVal = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;
    
		$('CommentTextArea'+komid).innerHTML = votetexte[returnVal];
		 },     
		onFailure: function(){ 
		$('CommentText'+komid).disabled = false;
		$('CommentTextArea'+komid).innerHTML = votetexte['COMMENTNOK'];
		}   
	}
	
	); 
	
	
	}
	
}

function ajaxtab(objurl, objid){
		
		new Ajax.Request(objurl,  {
		method:'get',
		onSuccess: function(transport){       

		 $(objid).innerHTML = transport.responseText;
		}
	}
	);
}


function VideoFav(vid,action){

		
		if(VFavstatus == 'none'){
			
			if(action > 0){
				VFavstatus = 'remove';
			}else{
				VFavstatus = 'add';
			}
			
		}
		
		
		new Ajax.Request('/tube/Remote_Video.setFavorit?noframe=1&action='+VFavstatus+'&vid='+vid,  {
		method:'post',
	onSuccess: function(transport){
    
    checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Video/'+vid);
    
    returnVal = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;

		 if(VFavstatus == 'add'){
		 		$('FavButton').title = votetexte['FAVREM'];
				$('FavButton').className = "Fav29x24_Active";
				VFavstatus = 'remove';
			}else{
				$('FavButton').title = votetexte['FAVADD'];
				$('FavButton').className = "Fav29x24";
				VFavstatus = 'add';
			}
		 
		 }
	}
	
	);
		
}


function ProfilFav(pid,action){

	if(PFavstatus == 'none'){
			
			if(action > 0){
				PFavstatus = 'remove';
			}else{
				PFavstatus = 'add';
			}
			
		}
		
	new Ajax.Request('/tube/Remote_Profil.setFavorit?noframe=1&action='+PFavstatus+'&id='+pid,  {
		method:'post',
	onSuccess: function(transport){
		 
		checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'Profil/'+pid);
   
    returnVal = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;
		 
		 	if(PFavstatus == 'add'){
		 	
		 		$('PFavButton').title = votetexte['FAVREM'];
		 		$('leftfavtext').innerHTML = votetexte['FAVREM'];
				$('PFavButton').className = "Fav29x24_Active";
				PFavstatus = 'remove';
			}else{
				$('PFavButton').title = votetexte['FAVADD'];
				$('leftfavtext').innerHTML = votetexte['FAVADD'];
				$('PFavButton').className = "Fav29x24";
				PFavstatus = 'add';
			}
		 }
 
	}
	
	);
		
		
}


function Loeschen(delurl,vid,text){
	
	Check = confirm(text);

if (Check == true){
	location.href=delurl+'/'+vid+'&action=del';
	return true;
	
}else{

	return false;
	
}
	
}

function startRating(rate,vid){
	
	if(ratingblock == false){
	
					ratingblock = true;
					$('voteinfo').innerHTML =	votetexte['start'];
						
					new Ajax.Request('/tube/Remote_Video.setVote?noframe=1&vote='+rate+'&vid='+vid,  {
						method:'post',
					onSuccess: function(transport){       

				    checkonlinestatus(transport.responseXML.getElementsByTagName('status')[0].firstChild.nodeValue,'User_Video/'+vid);
		
    				returnVar = transport.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;
				    
							$('voteinfo').innerHTML = votetexte[returnVar];

						 }
						 ,     
						 
						onFailure: function(){ 
							
							$('voteinfo').innerHTML =	votetexte['NOK'];
						
						}   
					}
					
					);
}

}

function displayObj(obj){
	
	$('kommentar').style.display='none';
	$('weiterempfehlen').style.display='none';
	$('favorit').style.display='none';

	$(obj).style.display='block';
	
}

function hiddenObj(obj){

	$(obj).style.display='none';
	
}

function selectradio(obj){
	
	obj = $(obj);
	
	obj.checked = true;
	
}


function checkForm(obj,pflicht)
{
	errorfeld = $('errorview');
	error 	= 0;
	
	pflicht = pflicht.split(",");
	
	 for(i = 0; pflicht.length > i;i++){
		
		$("error_"+pflicht[i]).style.display = 'none';

	 }
	 
	 for(i = 0; i < pflicht.length;i++){
   	
   	obj2 = $(pflicht[i]);
		
		if(obj2.type == 'checkbox'){
				
			if(obj2.checked == false){
			
			$("error_"+pflicht[i]).style.display = 'block';
				$("text_"+pflicht[i]).innerHTML = fehler[pflicht[i]];
			error++;	
			}
		
		
		}else{
			
			
		if(obj2.value.length <= 2){

				$("error_"+pflicht[i]).style.display = 'block';
				$("text_"+pflicht[i]).innerHTML = fehler[pflicht[i]];
				
   		error++;
  	}
   	
   	
   	if(obj2.id == 'vid_tags' && obj2.value.length > 2){
				
				check = CheckDuplicateArrayValue(obj2.value);
				
				if(check[0] == -1){
				
					$("error_"+pflicht[i]).style.display = 'block';
					$("text_"+pflicht[i]).innerHTML = check[1]+' - '+fehler['vid_doppelt'];
				
				error++;
				
				}
			
		}
   	
  	}
   	
   }
  
  
  if(error > 0){
 		
 		return false;
	
	}else{
	
		return true;
	
	}


}

function checkfilledOut(obj,a,b,evercheck){
var field;
var error = 0;
all = a+","+b;
all = all.split(",");
fieldlistA = a.split(",");
fieldlistB = b.split(",");
evercheck	=  evercheck.split(",");
DEOK = 0;
ENOK = 0;


for(i = 0; fieldlistA.length > i;i++){
		
		$("error_"+fieldlistA[i]).style.display = 'none';

	 }

for(i = 0; fieldlistB.length > i;i++){
		
		$("error_"+fieldlistB[i]).style.display = 'none';

	 }

if(evercheck[0].length > 0){
	
		for(i = 0; evercheck.length > i;i++){
				
				$("error_"+evercheck[i]).style.display = 'none';
		
			 }

}

for(i = 0; fieldlistA.length > i;i++){
		
		de = $(fieldlistA[i]);

		if(de.value.length >= 1){
   		DEOK++;
  	}
  	
}

for(i = 0; fieldlistB.length > i;i++){
		
		en = $(fieldlistB[i]);

		if(en.value.length >= 1){

   		ENOK++;
  	}
  	
}

if(DEOK == 0 && ENOK == 0){
DEOK =	fieldlistA.length;
ENOK =	fieldlistB.length;
}


if(DEOK != 0){

		for(i = 0; fieldlistA.length > i;i++){
		
			de = $(fieldlistA[i]);
		
			if(de.value.length <= 2){
					
	
					$("error_"+fieldlistA[i]).style.display = 'block';
					$("text_"+fieldlistA[i]).innerHTML = fehler[fieldlistA[i]];
					
	   		error++;
	  	}
	  	
  	}


}

if(ENOK != 0){
	
	for(i = 0; fieldlistB.length > i;i++){
		
			en = $(fieldlistB[i]);

			if(en.value.length <= 2){
					$("error_"+fieldlistB[i]).style.display = 'block';
					$("text_"+fieldlistB[i]).innerHTML = fehler[fieldlistB[i]];
					
	   		error++;
	  	}
	  	
  	}

}

if(evercheck[0].length > 0){

	for(i = 0; evercheck.length > i;i++){
		
			field = $(evercheck[i]);

			if(field.type == 'checkbox'){
				
			if(field.checked == false){
			
			$("error_"+evercheck[i]).style.display = 'block';
				$("text_"+evercheck[i]).innerHTML = fehler[evercheck[i]];
			error++;	
			}
		
		
		}else{
					
			if(field.value.length <= 2){
					
					$("error_"+evercheck[i]).style.display = 'block';
					$("text_"+evercheck[i]).innerHTML = fehler[evercheck[i]];
					
	   		error++;
	  }
	  
	  if(field.id == 'vid_tags' && field.value.length > 2){
				
				check = CheckDuplicateArrayValue(field.value);
				
				if(check[0] == -1){
				
					$("error_"+evercheck[i]).style.display = 'block';
					$("text_"+evercheck[i]).innerHTML = evercheck[1]+' - '+fehler['vid_doppelt'];
				
				error++;
				
				}
			
		}
	  
	  	
	  }
  }
}



if(error > 0){
 		
 		return false;
	
	}else{
	
		return true;
	
	}


}



function findePos(el,r){
var pos=0;
	if(el.offsetParent){
		while(el.offsetParent){
		
		pos+=r?el.offsetTop:el.offsetLeft;
		el=el.offsetParent;
		
		}
	}
else if(el.y){
	
	pos+=r?el.y:el.x;
	
	}
return pos;
}


function CheckDuplicateArrayValue(str){
	

	bitA = str.split(" ");
	bitB = str.split(" ");
	dupplicate = 0;
	exit = "";
	k = 0;
	l = 0;
	
	while (k < bitA.length){

		while (l < bitB.length){
		
			if(bitB[l].toLowerCase() == bitA[k].toLowerCase()){
				
				exit = bitB[l];
				dupplicate++;

			}
		
			l++;
		
		}
	
	if(dupplicate >= 2){
		
		bitA = new Array();
		bitB = new Array();
	
		
		return new Array('-1',exit);
		break;
		
	}
	
	dupplicate = 0;
	
	k++;
	}
	
	return new Array('0','');
}

function CheckAgb(dummy, text)
{
	
	 eval("obj = $('"+dummy+"');");

	
	if(obj.checked!=true){
		alert(text);
		return false;
	}else{

		return true;
	
	}
}

function checkDate(string)
{
    if(!string) return null;
    string += '';

    string = string.replace(/[^0-9^\.]/g, '');

    var split = string.split(".");
    var day = parseInt(split[0], 10);
    var month = parseInt(split[1] || 0, 10);
    var year = parseInt(split[2] || 0, 10);

    if(isNaN(year)) year = getFullYear();;

    var check = new Date(year, month - 1, day);
    var day2 = check.getDate();
    var year2 = getFullYear(check);
    var month2 = check.getMonth() + 1;

    if ( year2 == year && month == month2 && day == day2 ) return true;
    return false;
}

function getFullYear(date)
{
    if(!date) date = new Date();
    if(typeof date.getFullYear != 'undefined') return date.getFullYear();
    var year = date.getYear();
    if(year < 1000) year += 2000;
    return year;
}

function openPopup(theURL,winName,winX,winY) {
		
		posX=(screen.width/2)-(winX/2);
		posY=(screen.height/2)-(winY/2)-30;
		if (posY < 0){posY = 0;}
		winFeatures='width='+winX+', height='+winY+',innerHeight=580,innerWidth=0, left='+posX+', screenX='+posX+', top='+posY+', screenY='+posY+', toolbar=0, location=0, directories=0, status=0, menuBar=0, resizable=0, scrollbars=yes';
		win = window.open(theURL,winName,winFeatures);
		win.focus();
}


function Info(anfrage) {
 	
 obj = $('Userinfo');	
 obj.innerHTML = anfrage;

}


function InfoAusgabe(obj,ausgabe) {
 	
 obj = $(obj);	
 
  	if(isObject(obj)){
 			obj.innerHTML = ausgabe;
		}
}

function pause(millisecondi)
{
    var now = new Date();
    var exitTime = now.getTime() + millisecondi;

    while(true)
    {
        now = new Date();
        if(now.getTime() > exitTime) return;
    }
}


function hideok(obj){
		
		ChatTeaser = false;
				
		if(ie && !olOp)kill = $('killSelect');
		if(ie && !olOp)hideObject(kill);
		
		hideObject(obj);
		clearTimeout(timesaygoodbye);
	
	}


function hide(obj,usr_id_empf , chatcode , text){
		
		ChatTeaser = false;
		
		if(ie && !olOp)kill = $('killSelect');
		if(ie && !olOp)hideObject(kill);
		
		hideObject(obj);
		
		SendChatMsg(text , usr_id_empf , chatcode)
		clearTimeout(timesaygoodbye);
	
	}


function cleartime(){
	
		clearTimeout(timesaygoodbye);
	
	}


function checkLoginAGB(dummy)
{
	if($(dummy).checked!=true){
		alert('Du musst Die Agb akzeptieren.');
		return false;
	}
}

function isObject(a) 
 {
     return (typeof a == 'object' && !!a) || isFunction(a);
 }
 
function insert(aTag, eTag,form,element) {
  var input = $(element);
  input.focus();
  /* für Internet Explorer */

  
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    
    var range = document.selection.createRange();
    
    if(input.caretPos){
    var range = input.caretPos;
  	}
  	
  
  	if(!range){
    	return;
  	}
  	checklength = range.text;
		var insText = range.text;
    insText = range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
			if (navigator.userAgent.indexOf("Opera") == -1) {
				if(checklength.length > 0){
		      
				}else{
					
						range.move('character', -eTag.length);
				}
			}
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    if(input.tmpstart > 0){
    	var start = input.tmpstart;
    }else{
    	var start = input.selectionStart;
  	}
  	
  	if(input.tmpend > 0){
     var end = input.tmpend;
    }else{
   	 var end = input.selectionEnd;
  	}

    
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;

    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }

    input.selectionStart = pos;
    input.selectionEnd = pos;
    
  }
  /* für die übrigen Browser */
  else
  {
    /* Abfrage der Einfügeposition */
    var pos;
    var re = new RegExp('^[0-9]{0,3}$');
    while(!re.test(pos)) {
      pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
    }
    if(pos > input.value.length) {
      pos = input.value.length;
    }
    /* Einfügen des Formatierungscodes */
    var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
    input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
  }
}

function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}


function CountTextarea(obj,counter,max) {
	StrLen = obj.value.length
	if (StrLen == 1 && obj.value.substring(0,1) == " ") {
    	obj.value = ""
        StrLen = 0
    }
    if (StrLen > max ) {
    	obj.value = obj.value.substring(0,max)
        CharsLeft = 0
    } else {
        CharsLeft = max - StrLen
    }
  $(counter).innerHTML = CharsLeft;
}

function getElementTextXML(obj,tag){
    
        result = obj.getElementsByTagName(tag)[0];

    if (result && result.childNodes.length > 0) {

        if (result.childNodes.length > 1) {
            return result.childNodes[1].nodeValue;
        } else {
        	
            	return result.firstChild.nodeValue;    		

        }
    } else {
        return '';
    }
}

function checkonlinestatus(stat , go){
	
	switch(stat){
		case "online":
			return true;
		break;
		case "offline":
			location.replace('/tube/Register?jto='+go);
		return;
		break;
	}
	
}