function w_open (url)
{
	wn = 'wname' + Math.round (Math.random () * 10000);
	settings = 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0,width=' +screen.availWidth +',height=' +screen.availHeight +'';
	openedWindow = window.open (url, wn, settings);
	if (openedWindow.opener == null) openedWindow.opener = self;
	openedWindow.focus();
}
var height=0; 
var width=0; 
var br=''; 
if (self.screen)
{
	width = screen.width
	height = screen.height
}
if(width == 1024 && height == 768) {br="<div style='clear:both;'></div>";}
var cur_menu_name;
function open_menu2(menu_name, move_x)
{
	close_menu();
	cur_menu_name=menu_name;
	obj=document.getElementById(menu_name);
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	var pos=gOfs(obj);
	document.getElementById(menu_name+'_items').style.display='block';
		if (myHeight < pos.y+200) 
		{ 
			document.getElementById(menu_name+'_items').style.top=pos.y-340+"px";
		} else {
			document.getElementById(menu_name+'_items').style.top=pos.y-340 +"px";
		}
		document.getElementById(menu_name+'_items').style.left=pos.x+move_x +'px';


}

function open_menu3(menu_name, move_x)
{
	close_menu();
	cur_menu_name=menu_name;
	obj=document.getElementById(menu_name);
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	var pos=gOfs(obj);
	document.getElementById(menu_name+'_items').style.display='block';
		if (myHeight < pos.y+200) 
		{ 
			document.getElementById(menu_name+'_items').style.top=pos.y-340+"px";
		} else {
			document.getElementById(menu_name+'_items').style.top=pos.y-340 +"px";
		}
		document.getElementById(menu_name+'_items').style.left=pos.x+move_x +'px';


}

function preventSelection(element){
  var preventSelection = false;

  function addHandler(element, event, handler){
    if (element.attachEvent) 
      element.attachEvent('on' + event, handler);
    else 
      if (element.addEventListener) 
        element.addEventListener(event, handler, false);
  }
  function removeSelection(){
    if (window.getSelection) { window.getSelection().removeAllRanges(); }
    else if (document.selection && document.selection.clear)
      document.selection.clear();
  }
  function killCtrlA(event){
    var event = event || window.event;
    var sender = event.target || event.srcElement;

    if (sender.tagName.match(/INPUT|TEXTAREA/i))
      return;

    var key = event.keyCode || event.which;
    if (event.ctrlKey && key == 'A'.charCodeAt(0)) 
    {
      removeSelection();

      if (event.preventDefault) 
        event.preventDefault();
      else
        event.returnValue = false;
    }
  }

  addHandler(element, 'mousemove', function(){
    if(preventSelection)
      removeSelection();
  });
  addHandler(element, 'mousedown', function(event){
    var event = event || window.event;
    var sender = event.target || event.srcElement;
    preventSelection = !sender.tagName.match(/INPUT|TEXTAREA/i);
  });

  addHandler(element, 'mouseup', function(){
    if (preventSelection)
      removeSelection();
    preventSelection = false;
  });

  addHandler(element, 'keydown', killCtrlA);
  addHandler(element, 'keyup', killCtrlA);
}
function close_menu()
{
	if(cur_menu_name)
	{
		document.getElementById(cur_menu_name+'_items').style.display='none';
	}
}
function set_close_menu()
{
	close_menu();
}
function findPosX(obj)
{
    var curleft = 0;
    if (obj.offsetParent)
    {
    while (obj.offsetParent)
    {
        curleft += obj.offsetLeft
        obj = obj.offsetParent;
    }
    }
    else if (obj.x)
    curleft += obj.x;
    return curleft;
}
preventSelection(document);
function findPosY(obj)
{
    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 gOfs(obj){
	var x=0,y=0;
	
	y = findPosY(obj);
	x = findPosX(obj);
	return {x: x, y: y}
}
	function fxad(fx) {
		fx=fx+30;
		return fx;
	}


function showinfoform() {
	var h = document.documentElement.scrollTop + 10;
	var f = document.getElementById('infoform_container');
	
	
	var first_top = document.all ? document.documentElement.scrollTop : 10;
	$(f).css('top', first_top)
	//document.title = first_top;
	$(f).animate({left : 10},2550,false, function() {
			//$(this).removeClass('hidden');
			//alert('dd');
			//$(this).css({position:'fixed',top:'10px'})
			this.is_visible = true;
	});
}
function setCookie(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function hideinfoform() {
	$('#infoform_container').get(0).is_visible = false;
	$('#infoform_container').animate({left:-1000}, 500);
	setCookie('infoform_closed', 'true');
}
$(document).ready(function(){
    $(function() {
		$("#accordion").accordion({
			header: 'h4',
			collapsible: true,
			active: false,
			autoHeight: false
			});
	});
})
