function openWidow(url){
  window.open(url,'','width=665,height=600,scrollbars=yes')
}

var bgcolor_or;
var ftcolor_or;
function funcSetFocuse(obj,bgcolor){
	bgcolor_or = obj.style.backgroundColor;
	obj.style.backgroundColor = bgcolor;
}

function funcSetFontColor(obj,ftcolor){
	ftcolor_or = obj.style.color;
	obj.style.color = ftcolor;
}

function funcLostFocuse(obj){
	obj.style.backgroundColor = bgcolor_or;
	obj.style.color = ftcolor_or;
}

// get the paramater
function get_paramater(str, paramater){
	var url = document.URL
	var url = str;
	var start = url.indexOf("page=content/")

	//document.write(i);
	if (url.indexOf("&")!=-1) {
		end  = url.substr(start+13).indexOf("&");
	}
	else {
		end  = url.substr(start+13).indexOf("/");
	}
	if(end == -1)
			var page = url.substr(start+13)
	else
		var page = url.substr(start+13, end)	
	return page;
}

function auto_selection(){
	page = get_paramater(document.URL, "page");
	this_menu=document.getElementById("menu_" + page);

	if (this_menu!=undefined) 
	{
		if(this_menu.className == 'list'){
			this_menu.className = 'list1';
		}else{
			this_menu.className = 'navi1';
		}
	}
}

function enlargeImage(url){
	var mask = document.getElementById('popupMask');
	var frame = document.getElementById('popupFrame');
	var imgFrame = document.getElementById('popupImageFrame');
	var content = document.getElementById('popupContent');
	var body = document.getElementsByTagName('body')[0];
	var viewportwidth;
  var viewportheight;
  var top;
  var left;

  // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined')
	{
	    viewportwidth = window.innerWidth,
	    viewportheight = window.innerHeight
	}
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	else if (typeof document.documentElement != 'undefined'
       && typeof document.documentElement.clientWidth !=
       'undefined' && document.documentElement.clientWidth != 0)
  {
			viewportwidth = document.documentElement.clientWidth,
      viewportheight = document.documentElement.clientHeight
  }

  // older versions of IE
  else
  {
      viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
      viewportheight = document.getElementsByTagName('body')[0].clientHeight
  }

	content.src = url;
  body.style.position="fixed";
  body.style.left = (viewportwidth-780-16)/2 + "px";
	mask.style.display='block';
	if (viewportwidth>780){
				left = (viewportwidth-730)/2 ;
	}else if (viewportwidth>500){
		frame.style.width = viewportwidth-100+"px";
		imgFrame.style.width = viewportwidth-100+"px";
		left = 50 ;
	}else{
		frame.style.width = viewportwidth-10+"px";
		imgFrame.style.width = viewportwidth-10+"px";
		left = 5 ;
	}
	if (viewportheight>600){
		frame.style.height = viewportheight-100+"px";
		imgFrame.style.height = viewportheight-125+"px";
		top = 50 ;
	}else{
		frame.style.height = viewportheight-10+"px";
		imgFrame.style.height = viewportheight-35+"px";
		top = 5 ;
	}
	frame.style.display='block';
	if(!window.XMLHttpRequest){
	   frame.style.left = (document.documentElement.scrollLeft + left)+"px";
	   frame.style.top = (document.documentElement.scrollTop + top)+"px";
	   frame.style.position="absolute";
     window.onscroll = function(){
         frame.style.left = (document.documentElement.scrollLeft + left)+"px";
         frame.style.top = (document.documentElement.scrollTop + top)+"px";
         frame.style.position="absolute";
			}
   }else{
	    frame.style.left= left +"px";
	    frame.style.top= top +"px";
	    frame.style.position="fixed";
   }
}
function closePopup(){
	var mask = document.getElementById('popupMask');
	var frame = document.getElementById('popupFrame');
	var content = document.getElementById('popupContent');
	var body = document.getElementsByTagName('body')[0];

  body.style.position="relative";
  body.style.left = "0px";
	frame.style.display='none';
	mask.style.display='none';
	content.src = '';
}

