//if (self != top) top.location.href = self.location.href;
var $prev_id=0;
function makeHomePage($e,$u,$pid) {
    //alert($_agt);
    if($_agt.indexOf("firefox") == -1){
        $e.style.behavior='url(#default#homepage)';
        $e.setHomePage($u);
        $s=0;
    }else{
        $s=1
    }
	getReq('/tools/favorite.php?a=1&s='+$s+'&pid='+$pid,makeHomePage_OK);
}
function makeHomePage_OK(){
    return false;
}
function addToFavorites($url,$pid) {
	$title = $url;
	$url="http://"+$url;
	if(document.all) window.external.AddFavorite($url,$title)
	else if (window.sidebar)	 window.sidebar.addPanel($title, $url,"");
	else if(window.external) window.external.AddFavorite( $url, $title);
		
	getReq('/tools/favorite.php?a=2&s=0&pid='+$pid,makeHomePage_OK);
}


function goToBox(name, id) {
	document.getElementById("c1_" + id).src = c1.src;
	document.location = name;
}
var previous_box = 0;
function goTo($id) {
	if ($prev_id != 0) {
		el('bt_'+$prev_id).style.background=$prev_c;
	}
	$prev_id = $id;
	$prev_c  = el('bt_'+$id).style.backgroundImage;
	
	el('bt_'+$id).style.backgroundImage='url(/templates/styles/i/b10/box_title.gif)';
	document.location = "#b_"+$id;
}

function findPosX(obj){
	var curleft = 0;
	obj = document.getElementById('main_table_main');
	alert(document.getElementById('main_table_main').offsetLeft);
	
	
	if (obj.parentNode){
		while (obj.parentNode){
			//alert("ok:"+obj.offsetLeft);
			curleft += obj.offsetLeft
			obj = obj.parentNode;
		}
	}
	else if (obj.x)
	curleft += obj.x;
	return curleft;
}

function findPosY(obj){
	obj = document.getElementById('main_table_main');
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
	curtop += obj.y;
	return curtop;
}

function getObj(name){
	//alert("name:"+name);
	 if (document.getElementById){
	     if(document.getElementById(name)){
		   this.obj = document.getElementById(name);
		   this.style = document.getElementById(name).style;
	     }
	     else return false;
	 }
	 else if (document.all){
	     if(document.all[name]){
		   this.obj = document.all[name];
		   this.style = document.all[name].style;
	     }
	     else return false;
	 }
	 else if (document.layers){
		   if (document.layers[name]){
		   	this.obj = document.layers[name];
		   	this.style = document.layers[name];
		   }
		   else {
		    this.obj = document.layers.testP.layers[name];
		    this.style = document.layers.testP.layers[name];
		   }
	 }
}

function setLyr(){
  obj= new getObj("main_table_main");
  if(!obj) return;
  x=new getObj('float_banner');
  if(!x) return;
  $tw=760;
  $dw=document.body.offsetWidth;
  newX = $dw-(($dw-$tw)/2)+20;
  newY = findPosY(obj);
  newY+=220;
  if(x.style){
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	x.style.visibility='visible';
  }
}