//--------------------------------------------------

window.addEvent("load", function(){try{parent._loaded(true);}catch(e){_check_frames();}});
window.addEvent("unload", function(){try{parent._loaded(false);}catch(e){_check_frames();}});
window.onerror = function(e){return true;};

//--------------------------------------------------

var _error = function(e){
	try{top._error(e);}catch(e){};
	}

//--------------------------------------------------

var _log = function(obj){
	try{top._log(obj);}catch(e){_error(e);};
	}

//--------------------------------------------------

var _check_frames = function(){
	try{
		if(($defined(top)) && ($defined(top.frames)) && (top.frames.length > 0)){
			return true;
			}
		}
	catch(e){
		}
	
	_force_frames();
	}

//--------------------------------------------------

var _force_frames = function(){
	if(($defined(_noforce)) && (_noforce)){
		return true;
		}
	
	top.location.replace(swoop_cnf.frmurl);
	}

//--------------------------------------------------

var _commentbox = function(obj, mod, frm){
	try{
		if(($type(obj) == "element") && ($type(frm) == "element")){
			if(mod){
				obj.setStyles({"height" : 165});
				frm.setStyles({"display" : "block", "visibility" : "visible", "height" : "auto"});
				}
			else{
				obj.setStyles({"height" : 20});
				frm.setStyles({"display" : "none", "visibility" : "hidden", "height" : 1});
				}
			}
		}
	catch(e){
		_error(e);
		}
	}

//--------------------------------------------------

var _ntytoggle = function(obj){
	try{
		if(($type(obj) == "element") && (obj.tagName == "A")){
			obj = $(obj);
			
			var trg = $(obj.getProperty("rel"));
			var lla = obj.getParent().getElements("A");
			
			lla.each(function(itm, idx){
				itm.removeClass("act");
				});
			
			obj.addClass("act");
			
			if(($type(trg) == "element") && (trg.tagName == "DIV")){
				var lla = trg.getParent().getElements("DIV");
				
				lla.each(function(itm, idx){
					itm.setProperty("class", "ntyboff");
					});
	
				trg.setProperty("class", "ntybon");
				}
			}
		}
	catch(e){
		_error(e);
		}
	}

//--------------------------------------------------

var _ntyupdate = function(){
	_log("_check: call");
	if((top._onliner != null) && ($type(top._onliner) == "object")){
		if(top._onliner.nty){
			top._onliner.nty = false;
			_ntytoggle($("ntyb_user"));
			_ping();
			}

		$H({cht : $("ntybbdya"), msg : $("ntybbdyb"), bdy : $("ntybbdyc")}).each(function(grp, idx){
			if($type(grp) == "element"){
				if($type(top._onliner[idx]) == "array"){
					var tmp = new String("<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">");
					
					top._onliner[idx].each(function(itm, idx){
						tmp += "<tr>";
						tmp += "<td onclick=\"location.href='"+swoop_cnf.home+"bigfm/profil/"+itm.uid+"/profil.html';\"><i class=\"ntybico\" style=\"background-image:url('/content/application"+itm.dir+"/default.32.jpg');cursor:pointer;\">&nbsp;<\/i><\/td>";
						tmp += "<td><b>"+itm.tsp+" : "+itm.una+"<\/b> "+itm.evt+"</td>";
						tmp += "<\/tr>";
						});
					
					tmp += "<\/table>";
					}
				
				grp.set("html", tmp);
				}
			});
		}
	}

//--------------------------------------------------

var _chatstart = function(){
	try{
		var _chatwin=window.open("about:blank", "chatlauncher", "scrollbars=no,menubar=0,height=745,width=950,resizable=0,toolbar=no,location=0,status=0");
		
		if((_chatwin) && (_chatwin != null) && (!_chatwin.closed)){
			_chatwin.focus();
			document.chatlauncher.submit();
			}
		else{
			alert("PopUpBlocker!");
			}
		}
	catch(e){
		_error(e);
		}
	}

//--------------------------------------------------

var _bc_update = function(){
	try{
		alert("_bc_update!");
		}
	catch(e){
		_error(e);
		}
	}

//--------------------------------------------------

var _swfpage = function(p){
	try{
		location.href = swoop_cnf.home + "bigfm" + p;
		}
	catch(e){
		_error(e);
		}
	}

//--------------------------------------------------

var _gallery = function(pid, img){try{top._gallery(pid, img);}catch(e){_error(e);}};
var _goto = function(id, act){try{top._goto(id, act);}catch(e){_error(e);}};
var _confirm = function(path, mssg){try{top._confirm(path, mssg);}catch(e){_error(e);}};
var _votereload = function(doc, val, itm, mod){try{top._votereload(doc, val, itm, mod);}catch(e){_error(e);}};
var _vote = function(obj, val, itm, mod, draw){try{top._vote(obj, val, itm, mod, draw);}catch(e){_error(e);}};
var _dialog = function(mod, pid, arg){try{top._dialog(mod, pid, arg);}catch(e){_error(e);}};
var _ping = function(){try{top._ping();}catch(e){_error(e);}};
var _playlist = function(){try{top._playlist();}catch(e){_error(e);}};
var _plslist = function(){try{top._plslist();}catch(e){_error(e);}};
var _webradio = function(){try{top._webradio();}catch(e){_error(e);}};
var _battlestage = function(){try{top._battlestage();}catch(e){_error(e);}};
var _webcam = function(){try{top._webcam();}catch(e){_error(e);}};
var _homecam = function(){try{top._homecam();}catch(e){_error(e);}};
var _szmcall = function(szm){try{top._szmcall(szm);}catch(e){_error(e);}};
var _pictures = function(itm){try{top._pictures(itm);}catch(e){_error(e);}};
var _imgvote = function(itm){try{top._imgvote(itm);}catch(e){_error(e);}};
var _trkvote = function(itm){try{top._trkvote(itm);}catch(e){_error(e);}};
var _vidvote = function(itm){try{top._vidvote(itm);}catch(e){_error(e);}};
var _message = function(rcp, mod, ref){try{top._message(rcp, mod, ref);}catch(e){_error(e);}};
var player_box_open = function(){try{top._player_box_open($("radiobox"));}catch(e){_error(e);}};
var player_box_close = function(){try{top._player_box_close($("radiobox"));}catch(e){_error(e);}};
var _call_box_open = function(itm){try{top._call_box_open();}catch(e){_error(e);}};
var _call_box_close = function(itm){try{top._call_box_close();}catch(e){_error(e);}};

//--------------------------------------------------

window.addEvent("load", function(){try{window.setInterval(function(){_ntyupdate();}, 10000);_ntyupdate();}catch(e){_error(e);}});

//--------------------------------------------------

window.addEvent("load", function(){
	try{
		$$("div.tabs").each(function(item, i){
			item.childs = new Array();
			item.getElements("a[rel]").each(function(hit, j){	
				hit.bind = $(hit.getProperty("rel"));
				if(hit.bind!=null){
					item.childs.push(hit);
					hit.status = false;
					hit.parent = item;
					hit.setStyles({cursor:"pointer"});
					
					hit._enable = function(){
						this.addClass("act");
						this.bind.addClass("act");
						}
	
					hit._disable = function(){
						this.removeClass("act");
						this.bind.removeClass("act");
						}
						
					hit.onclick = function(e){
						if($type(this.parent) == "element"){
							var szm=$(this).getProperty("rev");
							if(szm!=null){
								_szmcall(szm);}
							this.parent.childs.each(function(child, k){
								child._disable();
								});
							}
						this._enable();
						}
					}
				});
			});
		}
	catch(e){
		_error(e);
		}
	});
	
//--------------------------------------------------