function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
				//alert("OK");
}

//Loading global images
//MM_preloadImages('/common/images/sidebar-base_f2.png','/common/images/sidebar-base_f5.png');

// Auto Scroll require PrototypeJS
/*
Event.observe(window, 'load', function() {
  $$('a[href^=#]:not([href=#])').each(function(element) {
    element.observe('click', function(event) {
      new Effect.ScrollTo(this.hash.substr(1));
      Event.stop(event);
    }.bindAsEventListener(element))
  })
})
*/

/* send form

function submitForm(formID) {
	document.forms[formID].submit();
}

*/

function openWin(theURL){//theURL , winName , width , height , scrollBars , Xmove , Ymove
	var  winName = "NW" , w = 600 , h = 600 , s = 0 , Xmove = 15 , Ymove = 15;
	NewWin = window.open(theURL , winName , 'width='+w+' , height='+h+' , scrollbars=' + s);
	NewWin.window.moveTo(Xmove , Ymove);
	NewWin.focus();
}

// jump menu
function go_news() {
				obj = document.getElementById("news_selector");
				top.location.href = obj.options[obj.selectedIndex].value;
}

function open_digitalbook(theURL,winName) { //v2.0
	if(winName=="d_book") {
	var popupwidth = 1012;
	var popupheight = 647;
	var tgt_url = "" + theURL;
  if (navigator.userAgent.indexOf('Safari') >= 0) {
    window.open(tgt_url,winName,'width=' + (popupwidth + 1) + ',height=' + (popupheight + 1));
  } else {
    window.open(theURL,winName,'width=' + popupwidth + ',height=' + popupheight);
  }
	}else{//pdf
		window.open(theURL,winName);
	}// end of if
}


function MM_openBrWindow(theURL,winName,popupwidth,popupheight) { //v2.0
  if (navigator.userAgent.indexOf('Safari') >= 0) {
    window.open(theURL,winName,'width=' + (popupwidth + 1) + ',height=' + (popupheight + 1));
  } else {
    window.open(theURL,winName,'toolbar=yes,location=yes,scrollbars=yes,resizable=yes,width=' + popupwidth + ',height=' + popupheight);
				//,'scrollbars=yes,resizable=yes,width=800,height=600'
  }
}

function resize_tos(openw) { //v2.0
//alert(navigator.userAgent);
	var popupwidth = 814;
	var popupheight = 800;
	var winName = "TOS";
	var my_win;
	var my_agent = navigator.userAgent;
	//var tgt_url = "/tos/index.html";
	
  if (my_agent.indexOf('Safari') >= 0) {
    window.resizeTo(815,750);
				
		} else if (my_agent.indexOf('MSIE 6.0') >= 0) {
				window.resizeTo(815,750);
		} else if (my_agent.indexOf('MSIE 7.0') >= 0) {
				window.resizeTo(820,750);
			} else if (my_agent.indexOf('MSIE 8.0') >= 0) {
				window.resizeTo(829,750);
			} else if (my_agent.indexOf('Macintosh') >= 0 && my_agent.indexOf('Firefox/3'>= 0) ) {
				window.resizeTo(815,750);
  } else {
    window.resizeTo(825,750);

  }
		
}

function open_tos() { //v2.0
	var popupwidth = 814;
	var popupheight = 800;
	var winName = "TOS";
	var my_win;
	var tgt_url = "/tos/index.html";
  if (navigator.userAgent.indexOf('Safari') >= 0) {
    my_win = window.open(tgt_url,winName,'toolbar=no,location=no,status=no,width=' + (popupwidth + 1) + ',height=' + (popupheight + 1) + ',resizable=yes, scrollbars=yes');
  } else {
    //my_win = window.open(tgt_url,winName,'width=' + popupwidth + ',height=' + popupheight);
				my_win = window.open(tgt_url,winName,'toolbar=no,location=no,status=no,width=' + (popupwidth + 1) + ',height=' + popupheight + ',resizable=yes, scrollbars=yes');

  }
		
		openw = "html";
		
}
