// JavaScript Document
//no right click without messsage //
/*
var message="";
document.oncontextmenu=new Function("return false")
///////////////////////////////////
function clickIE() {
	if (document.all) {
		(message);
		return false;
		}
	}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which==2||e.which==3) {
		(message);
		return false;}
		}
	}
	if (document.layers) {
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS;
	}else{
		document.onmouseup=clickNS;
		document.oncontextmenu=clickIE;
	}
	*/
//popup window opener
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//display message in status bar
function displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}
//popUp Window -> center
var newWindow
function popUpFitWindow(URL, winName, w, h, scrollbar, location, directories, status, menubar, toolbar, resizable, pos, fitWin){
	//check window popUp position
	if(pos == "center"){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}else if(pos == "random"){
			LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
			TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}else if(pos == null){
			LeftPosition=0;
			TopPosition=0;
	}
	if(fitWin){
		LeftPosition = 0;
		TopPosition = 0;
		w = screen.width;
		h = screen.height;
	}
	//construct the setting//location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',toolbar='+toolbar+',resizable='+resizable+';
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbar+',location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',toolbar='+toolbar+',resizable='+resizable+'';
	//open new window with setting
	newWindow = window.open(URL, winName, settings);
	//bring new window to front
	newWindow.focus();
	//parameter(URL, winName, width, height, scroll, location, directories, status, menubar, toolbar, resizable, pos)
	}
function popUpWindow(URL, winName, w, h, scrollbar, location, directories, status, menubar, toolbar, resizable, pos){
	//check window popUp position
	if(pos == "center"){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}else if(pos == "random"){
			LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
			TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}else if(pos == null){
			LeftPosition=0;
			TopPosition=0;
	}
	//construct the setting//location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',toolbar='+toolbar+',resizable='+resizable+';
	settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbar+',location='+location+',directories='+directories+',status='+status+',menubar='+menubar+',toolbar='+toolbar+',resizable='+resizable+'';
	//open new window with setting
	newWindow = window.open(URL, winName, settings);
	//bring new window to front
	newWindow.focus();
	//parameter(URL, winName, width, height, scroll, location, directories, status, menubar, toolbar, resizable, pos)
	}
//close popup window
function closePopUpWindow(){
	if (newWindow){
			newWindow.close();
			newWindow = null;
		}

	}
//close yourSelf
function closeSelf(){
		self.close();
	}
//bring window Behind
function bringBehind(){
		this.blur();
	}
//trigger window to front
function focusWindow(){
		this.focus();
}
//animate windoe
function TB_animateWindow(URL, redirect, slideFriction,windowWidth,windowHeight,targetWidth,targetHeight,fullScreen){
	//URL = URL to go
	//Redirect = enable the redirect method and point to the URL value: 0/1
	//slideFriction from 0.4(easeIn) - 1.4(bouncing)
	//windowWidth = original window width
	//window Height = orignal window Height
	//targetWidth = final window width //not necesary for fullScreen mode enabled
	//targetHeight = final window height //not necesary for fullScreen mode enabled
	//fullScreen = fullScreen mode value: 0/1
	
	if (fullScreen){
		targetWidth = screen.availWidth;
		targetHeight = screen.availHeight;
	 }

	if (windowWidth != targetWidth) windowWidth += (targetWidth - windowWidth)*slideFriction;
	if (windowHeight != targetHeight) windowHeight += (targetHeight - windowHeight)*slideFriction;
	//set window to center
	windowLeft = (screen.availWidth / 2) - (windowWidth / 2);
	windowTop = (screen.availHeight / 2) - (windowHeight / 2);
	//anim
	top.window.resizeTo(windowWidth,windowHeight);
	top.window.moveTo(windowLeft,windowTop);

	if (Math.round(windowWidth) != Math.round(targetWidth) || Math.round(windowHeight) != Math.round(targetHeight)){
		setTimeout('TB_animateWindow("' + URL + '", ' + redirect + ', ' + slideFriction + ', ' + windowWidth + ', ' + windowHeight + ', ' + targetWidth + ', ' + targetHeight + ', ' + fullScreen + ');',0.0001);
 	}else{
		if(redirect){
			redirect = null;
			window.location.replace(URL)
		}
	}
}
//shake screen //shake(2)
function shake(n) {
if (parent.moveBy) {
	for (i = 10; i > 0; i--) {
		for (j = n; j > 0; j--) {
				parent.moveBy(0,i);
				parent.moveBy(i,0);
				parent.moveBy(0,-i);
				parent.moveBy(-i,0);
         }
      }
   }
   
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];}}
	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
}
