//////////////////////////////////// 
var toolVars = null;
//////////////////////////////////// 
function oPage( p, w, h, title ){
	if(!w) w = 440;
	if(!h) h = 260;
	if(!title) title = '';
	var features = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+w+',height='+h+',dependent=1';
	window.popUpWin = window.open(p, title, features);
	window.popUpWin.focus();
}
//////////////////////////////////// 
function writeFlash( xName, xPath, W, H, xVars, xTrasp, xScale, xResponse ){

	xVars += "&appExt=php&";
	strSwf = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' + '\r';
	strSwf += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ' + '\r'; 
	strSwf += 'width="' + W + '" height="' + H + '" id="' + xName + '" align="middle"> ' + '\r';
	strSwf += '<param name="FlashVars" value="' + xVars + '">' + '\r';
	if( xScale ) 				strSwf += '<param name="Scale" value="' + xScale + '">' + '\r';
	if( xTrasp==true ) 	strSwf += '<param name="wmode" value="transparent"> ' + '\r';
	strSwf += '<param name="allowScriptAccess" value="sameDomain"> ' + '\r';
	strSwf += '<param name="movie" value="' + xPath + '"> ' + '\r';
	strSwf += '<embed FlashVars="' + xVars + '"  ';
	strSwf += 'src="' + xPath + '" width="' + W + '" height="' + H + '" name="' + xName + '" align="middle" ' ;
	if( xScale ) 				strSwf += 'scale="' + xScale + '"  ';
	if( xTrasp==true ) 	strSwf += 'wmode="transparent" ';
	strSwf += 'swLiveConnect="true" ';
	strSwf += 'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" /> ' + '\r';
	strSwf += '</object>';

	if( !xResponse ){
		document.write( strSwf );
	} else {
		return strSwf;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
function getDivStyle( xTg ){
	if( document.layers ){ 
		return eval('document.'+xTg); 
	}
	var xDiv = document.getElementById(xTg);
	if( xDiv ){
		if( xDiv.style ) return xDiv.style;
	}
	return;
}
//////////////////////////////////// 
function submitCommonForm( xForm, xURL ){
	var myForm = document.getElementById( xForm );
	if( xURL ){
		myForm.action = myForm.action + xURL;
	}
	myForm.submit();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 


//////////////////////////////////////////////////////////////////////////////////////////////////////////// 
function carrelloTimerSubmit( xIDitem ){
	setTimeout("submitCommonForm('customForm"+xIDitem+"')", 1000); 
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 



//////////////////////////////////////////////////////////////////////////////////////////////////////////// Cookie
function parseCookie() {
	//////////////////////////////////// 
	var cookieList = document.cookie.split("; ");
	var cookieArray = new Array();
	for (var i=0; i<cookieList.length; i++) {
		var name = cookieList[i].split("=");
		cookieArray[unescape(name[0])] = unescape(name[1]);
	}
	return cookieArray;
	//////////////////////////////////// 
}
function setCookie( strCookie ){
	//////////////////////////////////// 	
	var expireDate = new Date();
	expireDate.setDate(365 + expireDate.getDate());
	strCookie += "; expires=" + expireDate.toGMTString()+";"; 
	document.cookie = strCookie;
	//////////////////////////////////// 	
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 



//////////////////////////////////////////////////////////////////////////////////////////////////////////// 
function applyHandle( xHandle, xFunction ){
	if( document.layers ){ 		//NS
		document.body[xHandle] = xFunction;
	}else if( document.all ){ //IE
		document.body[xHandle] = xFunction;
	} else {									//MO
		this[xHandle] = xFunction;
	}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 



//////////////////////////////////////////////////////////////////////////////////////////////////////////// File Utility
function getFileExt( filePath ){
	var arrExt = filePath.split(".");
	if( arrExt.length>0 ) return arrExt[arrExt.length-1].toLowerCase(); 
	return '';
}
function getFileName( filePath ){
	filePath = filePath.replace(/\//ig,'\\');
	var arrPath = filePath.split("\\");
	if( arrPath.length>0 ) return arrPath[arrPath.length-1]; 
	return '';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 



//////////////////////////////////////////////////////////////////////////////////////////////////////////// 
function GetBrowser(){
	////////////////////////////////////
	if( navigator.appName.indexOf("Microsoft") > -1 ){
		return 'IE';
	} else {
		return 'FF';
	}
	////////////////////////////////////
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 


//////////////////////////////////////////////////////////////////////////////////////////////////////////// 
function IncludeJavaScript( jsFile ){
  document.write('<scr' + 'ipt language="javascript1.2" type="text/javascript" src="' + jsFile + '"></scr' + 'ipt>'); 
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 


////////////////////////////////////////////////////////////////////////////////////////////////////////////  Hide/View DIV
function setDivView( xDiv ){
	//////////////////////////////////// 
	var curDiv = getDivStyle(xDiv);
	//////////////////////////////////// 
	if(curDiv.display == "none"){

		curDiv.display = "";
		document.getElementById("bt"+xDiv).className = "click"+xDiv+"open";
		
	}else{
	
		curDiv.display = "none";
		document.getElementById("bt"+xDiv).className = "click"+xDiv;
	
	}
//////////////////////////////////// 
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////// 


////////////////////////////////////////////////////////////////////////////////////////////////////////////
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ControlVersion(){
	///////////////////////////////
	var version;
	var axo;
	var e;
	///////////////////////////////
	try {
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {	}
	if (!version)	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");
		} catch (e) {	}
	}
	if (!version)	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {	}
	}
	if (!version)	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "3,0,18,0";
		} catch (e) {
		}
	}
	if (!version)	{
		try {
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	///////////////////////////////
	return version;
	///////////////////////////////
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
function GetSwfVer(){
	///////////////////////////////
	var flashVer = -1;
	///////////////////////////////
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	///////////////////////////////
	flashVer = String(flashVer).replace('WIN ', '');
	///////////////////////////////
	return flashVer;
	///////////////////////////////
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////


