// Á¤»ó ·çÆ®¸¦ °ÅÄ¡Áö ¾Ê°í Á¢¼Ó½Ã ¸ÞÀÎÈ­¸éÀ¸·Î ¸®ÅÏ ½ÃÅ²´Ù.
/*if(!top.document.frames.mainFrame){
	top.document.location.href	= ROOT;
}*/
//=============================================== MMS Functions ===============================================//
	//SELECT ÅëÇÕ ¹Ù·Î°¡±â ¼­ºñ½º
	function brandGo() {
		if(document.Brand_Go.move.value == ''){
			alert("°¡Á·»çÀÌÆ®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
			return;
		} else {
			var go_value =document.Brand_Go.move.value 
			openWin(go_value,'','');
		}			
	}
	
	//µðÆúÆ® ÆË¾÷
	function DefaultpopUp(url, name) {
		var url		= ROOT+"Wproduct/"+url;
		var winname	= name;
		var val		= "status=yes,scrollbars=auto,width=10,height=10";
		openWin(url, winname, val);		
	}

	//µðÆúÆ® ÆË¾÷ »çÀÌÁî
	function DefaultpopUpSize(url, name, width, height) {
		var url		= ROOT+"Lproduct/"+url;
		var winname	= name;
		var width	= width;
		var height	= height;
		var val		= "status=yes,scrollbars=yes,width="+width+",height="+height;
		openWin(url, winname, val);		
	}	

	function getReload(){
		document.location.reload(true);
	}

	function getLocation(str){ document.location.href = str; }
	function noReady(){ alert("ÁË¼ÛÇÕ´Ï´Ù. ¼­ºñ½º ÁØºñÁß ÀÔ´Ï´Ù."); }
	function getFlashLocation(str){
		switch(str){			
			case "home":
				getLocation(ROOT);
				break;
			case "products":															//AP1
				getLocation(BLRURL+"/products/?mode=pro_ap1");
				break;
			case "products_01":															//AP1 Voice
				getLocation(BLRURL+"/products/?mode=pro_ap3&MnameSub=2");
				break;
			case "products_02":															//AP7
				getLocation(BLRURL+"/products/?mode=pro_ap2&MnameSub=3");
				break;
			case "products_03":															//AP300
				getLocation(BLRURL+"/products/?mode=pro_ap4&MnameSub=4");
				break;
			case "products_04":															//AP Black
				getLocation(BLRURL+"/products/?mode=pro_ap5&MnameSub=5");
				break;
			case "community":															//ÀÌº¥Æ®
				getLocation(BLRURL+"/community/?mode=comm1");
				break;
			case "community_01":														//Àü¹®°¡¸®ºä
				getLocation(BLRURL+"/community/?mode=comm2&MnameSub=3");
				break;
			case "community_02":														//´çÃ·ÀÚº¸±â
				getLocation(BLRURL+"/community/?mode=comm3&MnameSub=2");
				break;
			case "customer":															//°øÁö»çÇ×
				getLocation(BLRURL+"/customer/?mode=cust1");
				break;
			case "customer_01":															//Á¦Ç°µî·Ï
				getLocation(BLRURL+"/customer/?mode=cust2&MnameSub=2");
				break;
			case "customer_02":															//°í°´»ó´ã(FAQ)
				getLocation(BLRURL+"/customer/?mode=cust3&MnameSub=3");
				break;
			case "customer_03":															//°í°´»ó´ã(Q&A)
				getLocation(BLRURL+"/customer/?mode=cust4&MnameSub=3");
				break;
			case "customer_04":															//´Ù¿î·Îµå
				getLocation(BLRURL+"/customer/?mode=cust5&MnameSub=4");
				break;
			case "customer_05":															//A/S¾È³»
				getLocation(BLRURL+"/customer/?mode=cust6&MnameSub=5");
				break;
			case "customer_06":															//ÆÇ¸ÅÃ³¾È³»
				getLocation(BLRURL+"/customer/?mode=cust7&MnameSub=6");
				break;
			case "sitemap":
				getLocation(BLRURL+"/sitemap/?mode=sitemap");							//»çÀÌÆ®¸Ê
				break;	
			case "shopping":
				openWin("http://shop.speednavi.co.kr/goods_list.php?Index=286","","");
				break;
			case "promotion":
				getLocation(BLRURL+"/promotion/?mode=main");							//ÇÁ·Î¸ð¼Ç
				break;			
			default:
				getLocation(ROOT);
				break;
			
		}
	}
//=============================================== MMS Functions ===============================================//

//=============================================== Utils Functions ===============================================//
	function boolUserAgent(){
		var winIE	= parseFloat(navigator.appVersion.split("MSIE")[1]);
		var uAgent	= navigator.userAgent;

		if(uAgent.indexOf('Mac') >= 0){ winIE = 0; }
		else if(uAgent.indexOf('Windows CE') >= 0){ winIE = 0; }
		else if(uAgent.indexOf('Opera') >= 0){ winIE = 0; }

		if(winIE >= 5.5){ return true; }
		else{ return false; }
	}
	
//=============================================== Utils Functions ===============================================//

	function openWin(url, winname, val, status){
		window.open(url, winname, val);
	}

	// ÀÚµ¿ Æ÷Ä¿½º ÀÌµ¿
	function moveFocus(inObjSrc, len, inObjDesc){
		var KeyCode = event.keyCode;
		if((KeyCode >= 65 && KeyCode <= 90 || KeyCode >= 48 && KeyCode <= 57 || KeyCode >= 96 && KeyCode <= 105) && inObjSrc.value.length==len){
				inObjDesc.focus();
		}
	}

	// ¼ýÀÚ¸¸
	function num_only(){
		ascii	= event.keyCode;
		if(!( ((ascii >= getAscii("N0") && ascii <= getAscii("N9")) || (ascii >= getAscii("0") && ascii <= getAscii("9")) || 
			(ascii >= getAscii("left") && ascii <= getAscii("down")) || 
			ascii == getAscii("backspace") || ascii == getAscii("tab") || ascii == getAscii("return")) )){
			event.returnValue=false;
		}
	}

	// ½Ç½Ã°£ ¿µ¹® ¼ýÀÚ¸¸ ¹Þ±â
	function streamEngNum(){
		ascii	= event.keyCode;
		if(!((ascii >= getAscii("N0") && ascii <= getAscii("N9")) || (ascii >= getAscii("A") && ascii <= getAscii("Z")) || 
			(ascii >= getAscii("INSERT") && ascii <= getAscii("9")) || (ascii >= getAscii("HOME") && ascii <= getAscii("DOWN")) || 
			ascii == getAscii("backspace") || ascii == getAscii("tab") || ascii == getAscii("return"))){
			event.returnValue=false;
		}
	}

	// ¼ýÀÚ ¿µ¹®Á¶ÇÕ ¸¸ ¹Þ±â
	function chkEngNum(str){
		var rtn	= true;

		for(i=0; i < str.length; i++){
			ascii	= str.charCodeAt(i);

			if((ascii >= getAscii("N0") && ascii <= getAscii("N9")) || (ascii >= getAscii("0") && ascii <= getAscii("9")) || (ascii >= getAscii("A") && ascii <= getAscii("Z"))){
				rtn	= true;
			}
			else{
				rtn	= false;
				break;
			}
		}

		return rtn;
	}

	// ±Ý¾× Çü½ÄÀ¸·Î ,¸¦ ³Ö¾îÁØ´Ù.
	function number_format(str){
		str	= String(str);	// ¼ýÀÚ¸¦ ¹®ÀÚ¿­·Î º¯°æ
		var strLen	= str.length;
		var tmp		= new Array();

		for(i=0; i < strLen; i++){
			tmp[i]	= str.substr(i, 1);
		}

		strTemp	= "";
		for(i=tmp.length-1,j=0; i >= 0; i--,j++){
			if(j%3==0 && j != 0){
				strTemp	+= ","+tmp[i];
			}
			else{
				strTemp	+= tmp[i];
			}
		}

		strLen	= strTemp.length;
		str	= "";
		for(i=strLen-1; i >= 0; i--){
			str	+= strTemp.substr(i, 1);
		}

		return str;
	}

	// Å°ÀÌº¥Æ® ¹«È¿
	function chkkey(){
		event.returnValue	= false;
		event.keyCode		= 0;
		return false;
	}
	function clipboard_copy(text)
	{
		window.clipboardData.setData('Text', text);
		alert('º¹»çµÇ¾ú½À´Ï´Ù.');
	}

	function LoingCheckLocation()
	{
		getLocation(BLRURL+"/promotion/?mode=logincheck");
	}

	function EventState(step)
	{
		alert(step + '´Ü°è ÀÌº¥Æ®¿Ï·á µÇ¾ú½À´Ï´Ù. ³¡±îÁö ÀÀ¸ð ÇØÁÖ¼¼¿ä.');
	}

function UpdateDownCount(down_url)
{
	var target_url = down_url;
	var uid = $F('uid');
	var url = "FirmwareDown.mms";
	var pars = "uid="+uid;

	var A_Obj = new Ajax.Request(url,
				{
					method:"get",
					parameters: { uid : uid },
					onComplete: function () { getFirmwareDown(target_url); }					
				});
}

function getFirmwareDown(url)
{
	document.location.href = url;
}