var ext_href="";

function category_test(arr){
	//»ý°¢Áö ¾ÊÀº Ä«Å×°í¸®ÀÏ°æ¿ì..
	var category=new Array();
	if(!arr) return;
category=arr.split("/");

for(var i=0;i<category.length;i++){
	
		var objimage = document.querySelectorAll("#category a");
	if(category[i]!=null || typeof(category[i])!="undefined"){
		ext_href="http://http://cellular.co.kr/?cat="+category[i];
		break;
		}

		for(var j=0;j<objimage.length;j++){
			if(objimage[j].href==href){
					var href_img=objimage[i].getElementsByTagName("img")[0];

		//			href_img.src=href_img.src.replace('_off.gif','_on.gif');

			}
		}
		
}
}


/////2010-02-22 park yeon bae (add)
/*
		category 
   */
var locationDir=null;
	var objID, objUL;
var uniqkey=new Object();

function menuGNB_v3() {
	if (!(objID = document.getElementById('GnbMenu_area'))) return;
	if(userAgent()=="FF") objUL=document.querySelectorAll("#category");
	else if(userAgent()!="FF") objUL = document.getElementsByName("category");
	else return;	

	var initialize3 = function() {
		

		//20100223 park yeon bae title->sub title fix
		/*for (var i=0; i<objUL.length; i++) {

			objUL[i].onmouseover = function(){
				
				obj_uniqkey=uniqkey.getElementsByTagName("a")[0];
				obj_thisname=this.getElementsByTagName("a")[0];
				if(obj_uniqkey.href!=obj_thisname.href){

					var sub_objImage=uniqkey.getElementsByTagName('img')[0];
					sub_objImage.src=sub_objImage.src.replace('_on.gif','_off.gif');
					var sub_objDiv=uniqkey.getElementsByTagName('div')[0];
					sub_objDiv.style.display="none";
					var sub_objli=uniqkey.getElementsByTagName('li');

					for(var i=0;i<sub_objli.length;i++){

						var sub_liImg=sub_objli[i].getElementsByTagName('img')[0];
						sub_liImg.src=sub_liImg.src.replace('_on.gif','_off.gif');
					}
					var sub_objImage=this.getElementsByTagName('img')[0];
					sub_objImage.src=sub_objImage.src.replace('_off.gif','_on.gif');
					var sub_objDiv=this.getElementsByTagName('div')[0];
					sub_objDiv.style.display="block";
					var sub_objli=this.getElementsByTagName('li');
					for(var j=0;j<sub_objli.length;j++){
						var sub_img=sub_objli[j].getElementsByTagName('img')[0];
									sub_img.onmouseover=function(){
				this.src=this.src.replace("_off.gif","_on.gif");		
			}
			sub_img.onmouseout=function(){
				this.src=this.src.replace("_on.gif","_off.gif");			
				
			}
		}

					uniqkey=this;	
				}
			};

		uniqkey=objUL[i];		//	modify : first category not found image
		}*/
		//uniqkey=objUL[0];		
	};
	


initialize3();
}

function GetSearchQuery(subcount){
	var onLocation=location.href;
	if(onLocation.indexOf("?")>0){
		var strUri=onLocation.split('?');
		var strParam=strUri[1].split('&');

		return strParam[subcount-1];

	
}
}
function first_category(){
		var objImage=objUL[0].getElementsByTagName('img')[0];
		objImage.src = objImage.src.replace('_off.gif', '_on.gif');
		var objDiv=objUL[0].getElementsByTagName('div')[0];
		objDiv.style.display="block";
		var objli=objDiv.getElementsByTagName('li');
		
		

		
		/*for(var i=0;i<objli.length;i++){
			var liImg=objli[i].getElementsByTagName('img')[0];
			
			liImg.onmouseover=function(){

				this.src=this.src.replace("_off.gif","_on.gif");			
			}
			liImg.onmouseout=function(){
				this.src=this.src.replace("_on.gif","_off.gif");			
				
			}
		}*/
}
/*		useing title uri, image change function			*/
function location_title_text(get_href){
	// current uri is not use base64 encoding 
	href_uri=get_href.href.split("?")[1].split("&")[0];

	location_tag=document.getElementsByTagName("a");

	var i=0;

	while(i<location_tag.length){
		if(location_tag[i].href.split("?")[1]==href_uri){
		       	node_val=href_uri;
			break;
		}
		if(parseInt(i+1)==location_tag.length){
			node_val=location_tag[0].href;;
		}
		i++;
	}	

	i=0;
	if(userAgent()!="IE") var root_li=document.querySelectorAll("#category");
	else var root_li=document.getElementsByName("category");

	var root_chk=null;
	var root_chk_href=null;
	for(var i=0;i<root_li.length;i++){
		var child_a_tag=root_li[i].getElementsByTagName("a");

		for(var j=0;j<child_a_tag.length;j++){
			if(child_a_tag[j].href.split("?")[1]==node_val){
				root_chk_href=child_a_tag[j].href;
				root_chk=root_li[i];

				break;
			}
			
		}
	}
/**********cat°¡ ¾øÀ»°æ¿ì default·Î ¸ÇÃ³À½ÀÇ category·Î ÁöÁ¤**********/
//Â÷ÈÄ DB·Î categoryÁöÁ¤..

	if(root_chk==null){

					root_chk_href=child_a_tag[0].href;
					root_chk=root_li[0];
	}

	uniqkey=root_chk;			//Ä«Å×°í¸® ¼±ÅÃ½Ã º¸¿©Áú ¶Ç´Ù¸¥ Ä«Å×°í¸®(ÇöÁ¦´Â Ã¹¹øÂ° ¼­ºêÄ«Å×°í¸®¸¸ º¸ÀÌ°Ô²û)
	
	var root_img=root_chk.getElementsByTagName("img")[0];

	root_img.src=root_img.src.replace("_off.gif","_on.gif");

	if(userAgent()!="IE") var test=root_chk.querySelectorAll("div")[0].querySelectorAll("a");	
	else{
	       	var test=root_chk.getElementsByTagName("div")[0].getElementsByTagName("a");

	}

	for(var i=0;i<test.length;i++){

		if(test[i].href==get_href){
			test[i].firstChild.src=test[i].firstChild.src.replace("_off.gif","_on.gif");
		}
	}
	var div_element=uniqkey.getElementsByTagName("div")[0];
	div_element.style.display="block";

	// sub category image on programing
	}
function userAgent(){
var browserType="";
if(navigator.userAgent.indexOf("MSIE")!=-1) return "IE";
else if(navigator.userAgent.indexOf("Firefox")!=-1) return "FF";
else if(navigator.userAgent.indexOf("Mozilla")!=-1) return "MZ";
else if(navigator.userAgent.indexOf("Opera")!=-1) return "OP";
else if(navigator.userAgent.indexOf("Safari")!=-1) return "SF";
else if(navigator.userAgent.indexOf("Mac")!=-1) return "MC";
else return "NG";
}

//////////////////////////////

function sElement(ele){

if(document.querySelectorAll("#"+ele).length<=0){

	if(document.querySelectorAll("*[name="+ele+"]").length<=0){
		if(document.querySelectorAll(ele).length<=0){
			return ;
		}else return document.querySelectorAll(ele);
	}else return document.querySelectorAll(ele);

}else return document.querySelectorAll(ele);
}

function eventElement(obj,objstyle){
var objElement=document.getElementById(obj);
var styleEle=objElement.getAttribute("style");

	objElement.onmouseover=function(){
			objElement.style=objstyle;		
	}
	objElement.onmouseout=function(){
			objElement.style=styleEle;	
	
	}
}

function elementStyle(name,style){
		var objEle=document.getElementById(name);

if(objEle==null || typeof(objEle)=="undefined") return;

var styleEle=objEle.getAttribute("style");
var objstyle=style;
	objEle.onmouseover=function(){
			objEle.setAttribute("style",objstyle);		
	}
	objEle.onmouseout=function(){
			objEle.setAttribute("style",styleEle);		
	
	}

}
function notice_getCookie( name ){
    var nameOfCookie = name + "=";
    var x = 0;
    while ( x <= document.cookie.length )
    {
            var y = (x+nameOfCookie.length);
            if ( document.cookie.substring( x, y ) == nameOfCookie ) {
                    if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
                            endOfCookie = document.cookie.length;
                    return unescape( document.cookie.substring( y, endOfCookie ) );
            }
            x = document.cookie.indexOf( " ", x ) + 1;
            if ( x == 0 )
                    break;
    }
    return "";
}
	

window.onload=function(){

		elementStyle("featured_box","border:1px solid red");
		
		
		location_title_text(location);
		if(typeof(sidefade)=="function"){
			sidefade();
		}

		
//		ald_OpenBrWindow("./", "cellular", "location=0,scrollbars=1,status=0,menubar=0,toolbar=0,scrollbars=0,resizable=0", "100", "100", true, "cellular");
};

