// JavaScript Document

function lightBox() {
	WindowHeight = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
	OffWidth = document.documentElement.scrollWidth;
	OffHeight = document.documentElement.scrollHeight;
	if ( OffHeight < WindowHeight ) { OffHeight = WindowHeight; 	}
	
	var spinBox = document.createElement('div');
	spinBox.style.backgroundColor = "#000000";
	spinBox.id = "ThumbnailScroll_Box";
	spinBox.style.width = OffWidth + "px";
	spinBox.style.height = OffHeight + "px";
	spinBox.style.position = "absolute";
	spinBox.style.zIndex = 50;
	spinBox.style.left = spinBox.style.top = 0 + "px";
	if ( navigator.appName.indexOf("Explorer") != -1 ) {
		spinBox.style.filter="Alpha(opacity=20)";
	} else {
		spinBox.style.opacity=0.2;
	}
	document.documentElement.getElementsByTagName("body")[0].appendChild(spinBox);
	
	var spinIframe = document.createElement('iframe');
	spinIframe.id = "ThumbnailScroll_Iframe";
	spinIframe.style.width = OffWidth + "px";
	spinIframe.style.height = OffHeight + "px";
	spinIframe.style.position = "absolute";
	spinIframe.style.zIndex = 49;
	spinIframe.style.left = spinIframe.style.top = 0 + "px";
	if ( navigator.appName.indexOf("Explorer") != -1 ) {
		spinIframe.style.filter="Alpha(opacity=0)";
	} else {
		spinIframe.style.opacity=0;
	}
	document.documentElement.getElementsByTagName("body")[0].appendChild(spinIframe);
	
}

function lightBoxclose() {
	document.documentElement.getElementsByTagName("body")[0].removeChild(document.getElementById("ThumbnailScroll_Box"));
	document.documentElement.getElementsByTagName("body")[0].removeChild(document.getElementById("ThumbnailScroll_Iframe"));
}

function LayerPopupClose(obj) {
	var objName = document.getElementById(obj);
	objName.style.display = "none";
	lightBoxclose();
}

function LayerPopupMousePoint(e,obj,addX,addY) {
	var objName = document.getElementById(obj);
	if ( objName.style.display == "block" ) {
	} else {
		lightBox();
		objName.style.display = "block";
	}
}
function LayerPopupMousePointType1(e,obj,addX,addY) {
	var objName = document.getElementById(obj);
	if ( objName.style.display == "block" ) {
	} else {
		lightBox();
		objName.style.display = "block";
	}
}

// FAQ
function initToggle(tabContainer) {
	triggers = tabContainer.getElementsByTagName("a");

	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1])
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
		triggers.item(i).onclick = function () {
			if (tabContainer.current == this) {
				this.getElementsByTagName("span")[0].className = "close";
				this.targetEl.style.display = "none";
				tabContainer.current = null;
			} else {
				if (tabContainer.current) {
					tabContainer.current.targetEl.style.display = "none";
					tabContainer.current.getElementsByTagName("span")[0].className = "close";
				}
				this.getElementsByTagName("span")[0].className = "open";
				this.targetEl.style.display = "block";
				tabContainer.current = this;
			}
			return false;
		}
	}
}

// Layer Show-Hide
function showLayer(tgtEl)    {    document.getElementById(tgtEl).style.display = "block";    }
function hideLayer(tgtEl)    {    document.getElementById(tgtEl).style.display = "none";    }

// Select Links
function selectLinks(tgtEl)    {
	var tgtList = document.getElementById(tgtEl);
	if(tgtList.style.display)    {
		hideLayer(tgtEl);
		tgtList.style.display = "";
	} else {
		showLayer(tgtEl);
	}
}

// Embeded function image Over
function menuOver() {	this.src = this.src.replace("_off.gif", "_on.gif");}
function menuOut() {	this.src = this.src.replace("_on.gif", "_off.gif");}

// Tabbed menu
function initTabMenu(menuElId) {
	var tabMenu = document.getElementById(menuElId).getElementsByTagName("a");
	if(tabMenu.length > 0){
		for(i=0; i<tabMenu.length; i++) {
			thismenu = tabMenu.item(i);
			thismenu.menuContainer = document.getElementById(menuElId);
			thismenu.targetEl = document.getElementById(tabMenu.item(i).href.split("#")[1]);
			thismenu.targetEl.style.display = "none";
			if(thismenu.getElementsByTagName("img").length>0)	{
				thismenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
				thismenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
			}
			thismenu.onclick = tabMenuClick;
		}
		initmenu = tabMenu.item(0);
		initmenu.menuContainer = document.getElementById(menuElId);
		initmenu.targetEl = document.getElementById(initmenu.href.split("#")[1]);
		initmenu.targetEl.style.display = "block";
		initmenu.className = "activate";
		if(initmenu.getElementsByTagName("img").length>0)	{
			initmenu.getElementsByTagName("img").item(0).onmouseover();
			initmenu.getElementsByTagName("img").item(0).onmouseover = null;
			initmenu.getElementsByTagName("img").item(0).onmouseout = null;
		}
		initmenu.menuContainer.current = initmenu;
	}
}
function tabMenuClick() {
	currentmenu = this.menuContainer.current;
	if (currentmenu != this) {
		currentmenu.targetEl.style.display = "none";
		currentmenu.className = null;
		if(currentmenu.getElementsByTagName("img").length>0)	{
			currentmenu.getElementsByTagName("img").item(0).onmouseover = menuOver;
			currentmenu.getElementsByTagName("img").item(0).onmouseout = menuOut;
			currentmenu.getElementsByTagName("img").item(0).onmouseout();
		}
		this.targetEl.style.display = "block";
		this.className = "activate";
		if(this.getElementsByTagName("img").length>0)	{
			this.getElementsByTagName("img").item(0).onmouseover = null;
			this.getElementsByTagName("img").item(0).onmouseout = null;
		}
		this.menuContainer.current = this;
	}
	return false;
}


//收收收收收收收收收收收收收收收收收收收收收收收
// Ы楚衛 鳶殮
//收收收收收收收收收收收收收收收收收收收收收收收

function FlashObject(swf, width, height, bgcolor, id, flashvars)
{
    var strFlashTag = new String();

	var hosts = "";
	if (document.URL.indexOf("https://")==-1){hosts = "http://";}else{hosts = "https://";}
    
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        strFlashTag += 'codebase="'+ hosts +'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
        strFlashTag += 'id="' + id + '" width="' + width + '" height="' + height + '">';
        strFlashTag += '<param name="movie" value="' + swf + '"/>';
        
        if(flashvars != null) {strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>'};
        strFlashTag += '<param name="quality" value="best"/>';
        strFlashTag += '<param name="bgcolor" value="' + bgcolor + '"/>';
        strFlashTag += '<param name="menu" value="false"/>';
        strFlashTag += '<param name="salign" value="LT"/>';
        strFlashTag += '<param name="scale" value="noscale"/>';
        strFlashTag += '<param name="wmode" value="transparent"/>';
        strFlashTag += '<param name="allowScriptAccess" value="sameDomain"/>';
        strFlashTag += '</object>';
    }
    else
    {
        strFlashTag += '<embed src="' + swf + '" ';
        strFlashTag += 'quality="best" ';
        strFlashTag += 'bgcolor="' + bgcolor + '" ';
        strFlashTag += 'width="' + width + '" ';
        strFlashTag += 'height="' + height + '" ';
        strFlashTag += 'menu="false" ';
        strFlashTag += 'scale="noscale" ';
        strFlashTag += 'id="' + id + '" ';
        strFlashTag += 'salign="LT" ';
        strFlashTag += 'wmode="transparent" ';
        strFlashTag += 'allowScriptAccess="sameDomain" ';
        if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
        strFlashTag += 'type="application/x-shockwave-flash" ';
        strFlashTag += 'pluginspage="' + hosts + 'www.macromedia.com/go/getflashplayer">';
        strFlashTag += '</embed>';
    }

 document.write(strFlashTag);
}

function input_clearbg(id) {
	document.getElementById(id).style.background="#ffffff"; 
	topInputFocus = false;
}

function pageMove(){location.href='http://flyasianaclub.com/Korean/Club2008/MileageMall/Search_Result.jsp';}

function moveNext(){}
