//___________________________________________________________ [ Pop Up ]
var MacIe = navigator.userAgent.indexOf( "Mac" ) > -1 &&  navigator.userAgent.indexOf( "MSIE" ) > -1;
var JsWin;

function commonpop( JsUrl, JsWinName, JSWidth, JSHeight ){
	JSWidth = parseInt( JSWidth );
	JSHeight = parseInt( JSHeight );
	if( !MacIe ){ JSWidth = JSWidth + 16; }
	if( MacIe ){ JSWidth = JSWidth - 1 ; }
	JsProperty = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=" + JSWidth + ",height=" + JSHeight;
	JsWin = window.open( JsUrl, JsWinName, JsProperty );
	if( MacIe ){ return; }
	JsWin.focus();
}

function commonpop2( JsUrl, JsWinName, JSWidth, JSHeight ){
	JSWidth = parseInt( JSWidth );
	JSHeight = parseInt( JSHeight );
	JsProperty = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + JSWidth + ",height=" + JSHeight;
	JsWin = window.open( JsUrl, JsWinName, JsProperty );
	if( MacIe ){ return; }
	JsWin.focus();
}


//___________________________________________________________ [ Window Close ]
function closeIt() {
        top.window.close();
        return true;
}


//___________________________________________________________ [ Swap Image ]
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];}
}


//___________________________________________________________ [ Scroll ]
var strApp=navigator.appName;
var strVer=navigator.appVersion;

var Mac=strVer.indexOf('Mac',0)!=-1;
var Win=strVer.indexOf('Win',0)!=-1;
var IE=strApp.indexOf("Microsoft")!=-1;
var NN=strApp.indexOf("Netscape")!=-1;
var Vmajor=parseInt(strVer);
var Vminor=parseFloat(strVer);
var MacIE5=((Mac && strVer.indexOf('MSIE 5')!=-1)||(Mac && IE && Vmajor>4));
var MacIE4=(Mac && strVer.indexOf('MSIE 4.')!=-1);
var MacIE3=(Mac && strVer.indexOf('MSIE 3.')!=-1);

function getScrlLeft(){
	if(IE) return document.body.scrollLeft;
	else if(window.pageXOffset) return window.pageXOffset;
	else return 0;
}

function getScrlTop(){
	if(IE) return document.body.scrollTop;
	else if(window.pageYOffset) return window.pageYOffset;
	else return 0;
}

var tID;
function pageScrl(toX,toY,frms,cuX,cuY){
	if(tID) clearTimeout(tID);
	if(!toX || toX<0) toX=0;
	if(!toY || toY<0) toY=0;
	if(!cuX) cuX=0+getScrlLeft();
	if(!cuY) cuY=0+getScrlTop();

	cuX+=(toX-getScrlLeft())/frms;
	if(cuX<0) cuX=0;
	cuY+=(toY-getScrlTop())/frms;
	if(cuY<0) cuY=0;
	var posX=Math.floor(cuX);
	var posY=Math.floor(cuY);
	window.scrollTo(posX,posY);
	if(posX!=toX || posY!=toY) tID=setTimeout("pageScrl("+toX+","+toY+","+frms+","+cuX+","+cuY+")",16);
}

function scrlPageTop(){
	if(!MacIE3 && !MacIE4 && !NN && window.scrollTo || NN && (Vminor>=4.75) && window.scrollTo){
		pageScrl(0,0,4);
	}else{
 		location.hash="top";
	}
}


//___________________________________________________________ [ ContentsWindow ]
function cntWnd(outside, aid, mode, id, ch){
	ch = ''+ch;
	if (ch=="undefined") {
		ch = '';
	}
	var url = '/index.php?f=cntwnd&aid='+aid+'&id='+id+'&mode='+mode+'&outside='+outside+'&ch='+ch;
	if (outside) {
		var width = 580;
		var height = 550;
	} else {
		var width = 750;
		var height = 530;
	}
	window.open(url, 'cntwnd', 'width='+width+', height='+height+', resizable=yes');
}

function writeObjTag (filepath, width, height, id, args) {
	filepath = ''+filepath;
	width = ''+width;
	height = ''+height;
	args = ''+args;
	id = ''+id;
	if (filepath=="undefined") {
		return false;
	}
	if (width=="undefined") {
		return false;
	}
	if (height=="undefined") {
		return false;
	}
	if (args=="undefined") {
		args = '';
	}
	if (id=="undefined") {
		id = '';
	}
	
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'");
	document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/");
	document.write("flash/swflash.cab'");
	if (id) {
		document.write("id='"+id+"'");
		document.write("name='"+id+"'");
	}
	document.write("width='"+width+"' height='"+height+"'>");
	document.write("<param name='movie' value='"+filepath+"'>");
	document.write("<param name='quality' value='high'>");
	if (args) {
		document.write("<param name='FlashVars' value='"+args+"'>");
	}
	document.write("<embed src='"+filepath+"' quality='high'");
	document.write(" width='"+width+"' height='"+height+"'");
	if (id) {
		document.write("id='"+id+"'");
		document.write("name='"+id+"'");
	}
	document.write("width='"+width+"' height='"+height+"'");
	if (args) {
		document.write(" FlashVars='"+args+"'");
	}
	document.write(" type='application/x-shockwave-flash'");
	document.write(" pluginspage='http://www.macromedia.com/go/getflashplayer'>");
	document.write("</embed>");
	document.write("</object>");
}