/*
 * function : define flash tag and write
 * @info    : ActivX IE modify
 * @param fID(Flash ID), fURL(Flash URL), w(width), h(height)
 *        wmode(wmode value[null,0 - non select mode, 1 - select mode])
 *        bgClr(background color[null - no value, value - set value])
 *        lstate(loop value[null,0 - not define loop, 2 - loop false])
 *        rtnV(return type[null,0 - null, 1 - string])
 */
function drawFlash(fID, fURL, w, h, wmode, bgClr, lstate, rtnV, alnState) {
	var tmpStr = "";
	tmpStr += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='" + w + "' height='" + h + "' id='" + fID + "' name='" + fID + "' align='middle' type='application/x-shockwave-flash'>";
	tmpStr += "<param name='allowScriptAccess' value='always' />";
	tmpStr += "<param name='movie' value='" + fURL + "' />";
	tmpStr += "<param name='quality' value='high' />";
	tmpStr += "<param name='menu' value='false' />";

	if (lstate == 2) tmpStr += "<param name='loop' value='false' />";
	if (wmode == 1) tmpStr += "<param name='wmode' value='transparent' />";
	if (wmode == 2) tmpStr += "<param name='wmode' value='opaque' />";
	if (bgClr != null && bgClr != "undefined") tmpStr += "<param name='bgcolor' value='" + bgClr + "' />";
	if (alnState) tmpStr += "<param name='salign' value='"+alnState+"' />";
	tmpStr += "<embed src='" + fURL + "' quality='high' ";
	if (lstate == 2) tmpStr += "loop='false' ";
	if (wmode == 1) tmpStr += "wmode='transparent' ";
	if (wmode == 2) tmpStr += "wmode='opaque' ";
	if (bgClr != null && bgClr != "undefined") tmpStr += "bgcolor='" + bgClr + "' ";
	if (alnState) tmpStr += "salign='"+alnState+"' ";

	tmpStr += "width='" + w + "' height='" + h + "' name='" + fID + "' menu='false' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  />";
	tmpStr += "</object>";

	if (rtnV && rtnV == 1) { // return string
		return tmpStr;
	} else {
		document.write(tmpStr);
		eval("window."+fID+"=document.getElementById('"+fID+"');");
	}
}

/* function : check null */
function isNull(tObj) {
	if (tObj == null || tObj == "undefined") return true;
	return false;
}

/*
 * function : define popup window
 * @param url(page url), wname(popup name), w(width), h(height)
 *        ptype(popup type), t(top position), l(left position)
 */
function popWin(url,wname,w,h,ptype,t,l){
	var popupWin;
	var popOpt = "width="+w+",height="+h+"";
	if (!isNull(t)) popOpt += ",top="+t;
	if (!isNull(l)) popOpt += ",left="+l;
	if(ptype == 0){
		popOpt += ",scrollbars=no";
	}
	if(ptype == 1){
		popOpt += ",scrollbars=yes";
	}
	if(ptype == 2){
		popOpt += ",scrollbars=yes,resizable=yes";
	}
	if(ptype == 3){
		popOpt += ",scrollbars=no,resizable=yes";
	}
	popupWin = window.open(url,wname,popOpt);
	popupWin.focus();
}

/*
 * function : define popup close
 */
function popClose() {
	try {
		if (window.opener != null && window.opener.closed) window.opener = self;
	} catch (e) {
		window.opener = self;
	}
	self.close();
}

/* function : zipcode mouse over/out */
function defaultStatus(obj){
	obj.className = "trout";
}
function mouseOnTD(obj) {
	obj.className = "trover";
}



function goEvt01(){
	alert("ÀÌº¥Æ®°¡ Á¾·áµÇ¾ú½À´Ï´Ù.");
	/*
	var tmpURL = "/olympus/quiz.asp";
	if (tmpURL) {
		toggleMaskDiv();
		sendURLMsg(tmpURL);
	}*/
	//popWin('/olympus/quiz.asp','pop',559,540,0,0,'');
}

function goEvt02(val){
	alert("ÀÌº¥Æ®°¡ Á¾·áµÇ¾ú½À´Ï´Ù.");
	/*
	var tmpURL = "/olympus/dslr01.asp";
	addFormValue("hfrm", [["cnt",val]]);
	if (tmpURL) {
		toggleMaskDiv();
		sendURLMsg(tmpURL);
	}*/
	//popWin('/olympus/dslr01.asp?cnt='+val,'pop',559,660,0,0,'');
}

/* Drop Down List : ¼±ÅÃÇÑ °ªÀ» inputbox¿¡ »Ñ¸®°í º¸¿©ÁØ´Ù */
function sel_option(str1,str2) {
	var tmpfld, tmpId1, tmpId2
	if (str1 == "Á÷Á¢ÀÔ·Â") {
		tmpId1 = document.getElementById("dat2");
		tmpId1.style.display = "none";
	}
	else {
		tmpId1 = document.getElementById("dat2");
		tmpId1.value = str1;
		tmpId1.style.display = "block";
	}

	tmpfld = document.getElementById("dat1");
	tmpfld.value = str2;

	tmpId2 = document.getElementById("optList");
	tmpId2.style.display = "none";
}

/* Drop Down List Toggle ( ÆîÄ§/´ÝÈû) */
function down_option() {
	var tmpBlock1, tmpBlock2 ;

	tmpId1 = document.getElementById("optList");
	tmpBlock1 =  (tmpId1.style.display == "none")?"block":"none";
	tmpId1.style.display = tmpBlock1;

	tmpId2 = document.getElementById("dat2");
	tmpBlock2 =  (tmpId2.style.display == "none")?"block":"none";
	tmpId2.style.display = tmpBlock2;
}

function open_list() {
	tmpId1 = document.getElementById("optList");
	tmpBlock1 =  (tmpId1.style.display == "none")?"block":"none";
	tmpId1.style.display = tmpBlock1;
}

function mailSelect(idx, idy) {
	var tmpID = document.getElementById("dat" + idx + "_1");
	if (tmpID) {
		if (idy == "") tmpID.readOnly = false;
		else tmpID.readOnly = true;
	}
	tmpID.value = idy;
}


/* function : add onload function */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof(window.onload) != "function") {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

/* function : add onresize function */
function addResizeEvent(func) {
	var oldonresize = window.onresize;
	if (typeof(window.onresize) != "function") {
		window.onresize = func;
	} else {
		window.onresize = function() {
			oldonresize();
			func();
		}
	}
}

function viewObj(tObj) {
	var tmpStr = "";
	for (oIdx in tObj) {
		tmpStr += oIdx + " -> " + tObj[oIdx] + "\t";
	}
	alert(tmpStr);
}


/* PNG ÀÌ¹ÌÁö Ã³¸® ÇÔ¼ö */
function setPng24(obj) {
	try {
		obj.width=obj.height=1;
		obj.className=obj.className.replace(/\bpng24\b/i,'');
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');";
		obj.src='';
		return '';
	} catch(e) {}
}




/* ¸Þ¼¼Áö Ã¢¿¡ URL È£Ãâ */
function sendURLMsg(url, target) {
	if (url) {
		var tmpForm = (document.getElementById("hfrm"))?document.getElementById("hfrm"):parent.document.getElementById("hfrm");
		if (tmpForm) {
			if (target == "m2ifrsub") { // ¼­¹ö iframe ¸í
				var tmpIfrSubDiv = parent.document.getElementById("isubmsg");
//				alert("tmpIfrSubDiv : get");
				if (tmpIfrSubDiv) tmpIfrSubDiv.style.display = "block";
			}
			tmpForm.target = (target)?target:"m2ifr";
			tmpForm.action = url;
//			chgBGFla(); // ÇÃ·¡½¬ ±³Ã¼
			tmpForm.submit();
		}
	}
	return false;
}


/* ¸Þ¼¼Áö ·¹ÀÌ¾î ´Ý±â ÇÔ¼ö */
function closeMsg() {
	try {
		var tmpDiv = (document.getElementById("cmask"))?document.getElementById("cmask"):parent.document.getElementById("cmask");
		var tmpIfrDiv = (document.getElementById("imsg"))?document.getElementById("imsg"):parent.document.getElementById("imsg");
		var tmpIfrSubDiv = (document.getElementById("isubmsg"))?document.getElementById("isubmsg"):parent.document.getElementById("isubmsg");

		document.location.href = "about:blank"; // ºó ¹®¼­
		if (tmpIfrSubDiv && tmpIfrSubDiv.style.display == "block") { // ¼­ºê Msg Ã¢ÀÌ ¶°ÀÖ´Â °æ¿ì
			tmpIfrSubDiv.style.display = "none";
		}
		else {
			if (tmpIfrDiv) tmpIfrDiv.style.display = "none";
			if (tmpDiv) tmpDiv.style.display = "none";
		}
	} catch(e) {}
}

function closeAndGo() {
	self.location.href = "evt02.asp";		
}

	if(document.layers){n=1;ie=0}
	if(document.all){n=1;ie=0}

	function clickEvent(e){
		if(e.which==3){
		return false;
		}
	}

	function clickEvent(e){
		if(event.button==2){
		}
	}

//	if(n)
//	document.onmousedown=clickEvent;
//	if(ie)
//	document.onmousedown=click;



/* ·¹ÀÌ¾î show/hide */
function shoLayer(idx) {
	var tmpObj = document.getElementById(idx);
	if (is_null(tmpObj)) return;
	tmpObj.style.visibility = "visible";
}

function hidLayer(idx) {
	var tmpObj = document.getElementById(idx);
	if (is_null(tmpObj)) return;
	tmpObj.style.visibility = "hidden";
}


/* null check */
function is_null(sVal, cCode) {
	if (sVal == null || sVal == "undefined") return true;
	return (cCode == 1 && sVal == "")?true:false;
}

function addFormValue(tFrm, param) {
	var tmpFrm = document.getElementById(tFrm);
	if (tmpFrm && param) {
		tmpFrm.innerHTML = "";
		for (var i = 0, loopCount = param.length; i < loopCount; i++) {
			tmpFrm.innerHTML += "<input type=\"hidden\" name=\""+param[i][0]+"\" value=\""+param[i][1]+"\" />";
		}
	}
}


function goGallery(man,num){
	var tmpImg = new Image();
	var tmpWin, w, h;
	if (man) {
		tmpImg.src = "/olympus/img/pic/use"+man+"_"+num+".jpg";
		w = tmpImg.width;
		h = tmpImg.height;
		if (w > 0 && h > 0) {
			if (tmpImg) {
				tmpWin = window.open("","","width="+w+",height="+h+",'1',scrollbars=no,resizable=yes");
				tmpWin.document.open();
				tmpWin.document.writeln("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=euc-kr\" \/><title>¿Ã¸²Çª½º DSLR È°¿ëºñ¹ý</title></head>");
				tmpWin.document.writeln("<body style=\"margin:0px;padding:0px;\"><a href=\"javascript:self.close();\"><img src=\""+tmpImg.src+"\" border=\"0\" \/></a><\/body><\/html>");
				tmpWin.document.close();
			}
		} else {
			setTimeout(function(){goGallery(man,num);}, 20);
		}
	}
}


//dslr 2Â÷ ÀÌº¥Æ®½Ã Ãß°¡ 

function flvInit( value ) {
	
	var url
	
	switch( value ) {
		case 1 : url = "http://leenjangogilvy2.cafe24.com/dslr2/mov/olympus_tech.flv"
		break;
		case 2 : url = "http://leenjangogilvy2.cafe24.com/dslr2/mov/olympus_all.flv"
		break;
		case 3 : url = "http://leenjangogilvy2.cafe24.com/dslr2/mov/olympus_making.flv"
		break;
		case 4 : url = "http://leenjangogilvy2.cafe24.com/dslr2/mov/olympus_Heritage.flv"
		break;
	}
	
	return url;
}

function getMovie(val) {
	if(val){
		if (val == "1"){
			self.location.href="http://leenjangogilvy2.cafe24.com/dslr2/downloads/olympus_tech.zip";
		}else if (val == "2"){
			self.location.href="http://leenjangogilvy2.cafe24.com/dslr2/downloads/olympus_all.zip";
		}else if (val == "3"){
			self.location.href="http://leenjangogilvy2.cafe24.com/dslr2/downloads/olympus_making.zip";
		}else if (val == "4"){
			self.location.href="http://leenjangogilvy2.cafe24.com/dslr2/downloads/olympus_Heritage.zip";
		}		
	}
}

function goEvtMay01(val){
	alert("ÀÌº¥Æ®°¡ Á¾·áµÇ¾ú½À´Ï´Ù.");
/*
	var checkStr
	checkStr=/[^1-4]/;
	
	if (!val){
		alert("¼±ÅÃ°ªÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.");
	}else{
		if(String(val).search(checkStr) != -1){
			alert("¼±ÅÃ°ªÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.");
		}else{
			var tmpURL = "/olympus/dslr_evt02_pop.asp";
			addFormValue("hfrm", [["code",val]]);
			if (tmpURL) {
				toggleMaskDiv();
				sendURLMsg(tmpURL);
			}
		}
	}
*/
}

function goEvtMay02(val){
	alert("ÀÌº¥Æ®°¡ Á¾·áµÇ¾ú½À´Ï´Ù.");
/*
	var tmpURL = "/olympus/dslr_evt02_2_pop.asp";
	addFormValue("hfrm", [["point",val]]);
	if (tmpURL) {
		toggleMaskDiv();
		sendURLMsg(tmpURL);
	}
*/
}

