// Do not edit! Unless you know what you are doing! 
// By Ton Hanchai


function changeScrollbarColor(C)
{
  if (document.all){
    document.body.style.scrollbarBaseColor = C
  }   
}

function maxWindow()
{
window.moveTo(0,0);


if (document.all)
{
  top.window.resizeTo(screen.availWidth,screen.availHeight);
}

else if (document.layers||document.getElementById)
{
  if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
  {
    top.window.outerHeight = screen.availHeight;
    top.window.outerWidth = screen.availWidth;
  }
}
}


function openCourseWin(url,title) {
	tbWindow = window.open(url,title,"left=0,top=0,toolbar=0,location=0,status=0,width=567,height=340,resizable=0,scrollbars=0");
}

function openPopup(url,title) {
	tbWindow = window.open(url,title,"left=0,top=0,toolbar=0,location=0,status=0,width=567,height=340,resizable=0,scrollbars=1");
}

function loadLanguage(url) {
	if(confirm( 'You are about to switch to Japanese version! \r\r'+
                    'ARE YOU SURE YOU WANT TO DO SO?')) 
        {
		var lang_present = "eng"
		var lang_swicth_to = "jap"
		var the_url = url

		var language_start = the_url.indexOf(lang_present);

		var name_start = language_start + 3;
		var without_path = the_url.substring(name_start, the_url.length);

		var name_end = language_start;
		var with_path = the_url.substring(0, name_end);

		window.location = with_path + lang_swicth_to + without_path;

		//alert('The path is:'+ with_path + lang_swicth_to + without_path); 
	}
}

function FullWindow(url)
{
	w=800
	h=600
	if (window.screen) {
	   w = window.screen.availWidth - 10;
	   h = window.screen.availHeight - 55;
	}
	window.open(url,'_blank','width='+w+',height='+h+',top=0,left=0,toolbar=0,location=0,status=0,resizable=0,scrollbars=1');
        //window.self.open(url,'_self','width='+w+',height='+h+',top=0,left=0,toolbar=0,location=0,status=0,resizable=0,scrollbars=1');
        //myWindow.location.href = url;
	//window.self.close();
        //mainwindow.windows.open();
}

function shakeIt(){
	if (window.self.moveBy) {
		for (i = 5; i > 0; i--) 
		{
			for (j = 4; j > 0; j--) 
			{
				window.self.moveBy(0,i);
				window.self.moveBy(i,0);
				window.self.moveBy(0,-i);
				window.self.moveBy(-i,0);
         		}
      		}
	}
}

function moveIt(){
	if (window.self.moveBy) {
		for (i = 10; i > 0; i--) 
		{
			window.self.moveBy(-i,0);
      		}
	}

	if (window.self.moveBy) {
		for (i = 10; i > 0; i--) 
		{
			window.self.moveBy(i,0);
      		}
	}
	window.self.close();

	if (window.self.moveBy) {
		for (i = 8; i > 0; i--) 
		{
			for (j = 5; j > 0; j--) 
			{
				window.self.moveBy(i,0);
				window.self.moveBy(-i,0);
         		}
      		}
	}
}

function openWinCenter(url,popW,popH) {
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	//var popW = 350, popH = 200;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
        var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=0');
	newWindow.focus();

	//msgWindow=window.open("","displayWindow","menubar=0,scrollbars=0,status=0,width=300,height=300")
	//newWindow = window.open('','_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
    	//newWindow.document.write("<head><title>Portfolio...</title><script language=Javascript src=global.js></script></head>")
	//newWindow.document.write("<body onload=shakeIt()>");
	//newWindow.document.write("<img src='imgs/r-glasses-book.jpg'");
	//newWindow.document.write("<a href=javascript:window.self.close()>close</a>");
	//newWindow.document.write("</body></html>");
}

function openWinCenterScroll(url,popW,popH) {
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	//var popW = 350, popH = 200;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
        var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
	newWindow.focus();

	//msgWindow=window.open("","displayWindow","menubar=0,scrollbars=0,status=0,width=300,height=300")
	//newWindow = window.open('','_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
    	//newWindow.document.write("<head><title>Portfolio...</title><script language=Javascript src=global.js></script></head>")
	//newWindow.document.write("<body onload=shakeIt()>");
	//newWindow.document.write("<img src='imgs/r-glasses-book.jpg'");
	//newWindow.document.write("<a href=javascript:window.self.close()>close</a>");
	//newWindow.document.write("</body></html>");
}

function fullScreen(thisURL) {
window.open(thisURL, '', 'fullscreen=yes, scrollbars=auto');
}

function openWinCenterScrollResize(url,popW,popH) {
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	//var popW = 350, popH = 200;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
        var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1, resizable=1');
	newWindow.focus();

	//msgWindow=window.open("","displayWindow","menubar=0,scrollbars=0,status=0,width=300,height=300")
	//newWindow = window.open('','_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
    	//newWindow.document.write("<head><title>Portfolio...</title><script language=Javascript src=global.js></script></head>")
	//newWindow.document.write("<body onload=shakeIt()>");
	//newWindow.document.write("<img src='imgs/r-glasses-book.jpg'");
	//newWindow.document.write("<a href=javascript:window.self.close()>close</a>");
	//newWindow.document.write("</body></html>");
}

function openwin(url) {
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 600, popH = 500;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
	newWindow.focus();
}

function closeWin() {
	window.self.close();
}

function shakeAndCloseWin(){
	if (window.self.moveBy) {
		for (i = 5; i > 0; i--) 
		{
			window.self.moveBy(-i,0);
      		}
	}

	if (window.self.moveBy) {
		for (i = 5; i > 0; i--) 
		{
			window.self.moveBy(i,0);
      		}
	}
	window.self.close();
}

function shakeAndCloseWinDelay(){
	if (window.self.moveBy) {
		for (i = 3; i > 0; i--) 
		{
			for (j = 2; j > 0; j--) 
			{
				window.self.moveBy(i,0);
				window.self.moveBy(-i,0);
         		}
      		}
	}

	if (window.self.moveBy) {
		for (i = 5; i > 0; i--) 
		{
			window.self.moveBy(-i,0);
      		}
	}

	if (window.self.moveBy) {
		for (i = 5; i > 0; i--) 
		{
			window.self.moveBy(i,0);
      		}
	}
	window.self.close();
}

function loadPrinter() {
	if (window.print) 
		window.print();
} 

function openwin500_375(url)
{
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 375, popH = 500;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
	newWindow.focus();

        //window.open(url,"_blank","toolbar=no,statusbar=no,menubar=no,scrollbars=no,height=375,width=500,screenX=0,screenY=0,location=no,directory=no,resizable=no");
}
function openwin550_320(url)
{
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 550, popH = 320;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
	newWindow.focus();

 	//window.open(url,"_blank","toolbar=no,statusbar=no,menubar=no,scrollbars=no,height=320,width=550,screenX=0,screenY=0,location=no,directory=no,resizable=no");
}

function openwin550_400(url)
{
	var w = 480, h = 340;
	if (document.all || document.layers) {
		w = screen.availWidth;
   		h = screen.availHeight;
	}

	var popW = 550, popH = 400;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	var newWindow = window.open(url,'_blank','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ',scrollbars=1');
	newWindow.focus();

 	//window.open(url,"_blank","toolbar=no,statusbar=no,menubar=no,scrollbars=no,height=400,width=550,screenX=0,screenY=0,location=no,directory=no,resizable=no");
}