

$(document).ready(function(){
	//$("dd:not(:first)").hide();
	//$("dd:not(dd[show='yes'])").hide();
	$(".leftm dd:not(.show_lm)").hide();
	$(".leftm dt").attr("clicked", "N");
	$(".leftm .hover").attr("clicked", "Y");

	$(".leftm dt").hover(function(){
		$(this).addClass("hover");
	}, function(){
		if ($(this).attr("clicked") == "N")
			$(this).removeClass("hover");
	});

	$(".leftm dt span").click(function(){
		$(".leftm dd:visible").slideUp("slow");
		$(this).parent().next().slideDown("slow");

		$(".leftm dt").removeClass("hover");
		$(".leftm dt").attr("clicked", "N");
		$(this).parent().addClass("hover");
		$(this).parent().attr("clicked", "Y");
		return false;
	});
});


$(document).ready(function(){
    // top_util submenu
    $("li.tabControlMenu").mouseover(function(){
        var id = $(this).attr("id").replace("m", "");

        $("div.tabContent").each(function(){
            $(this).css("display", "none");
        });

	$("#Stop_nav").css("height", "110px");
        //$("div#tabContent"+id).fadeIn("slow");

	$('div[id*="dep2_"]').mouseleave(function(){
        	$("#Stop_nav").css("height", "34px");
        	$('div[id*="dep2_"]').css("display", "none");
        });
       
    });
 	
});

function embedFlash_other(id, url, width, height, flashVars, wmode, replaceObj) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'transparent';
	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height + '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<param name="allowScriptAccess" value="always" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '" name="' + id + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
			'<param name="allowScriptAccess" value="always" />' +
		'<!--<![endif]-->';
		document.write(str);
		//setScroll_GNB(dCarCnt);
		document.write(document.getElementById(replaceObj).innerHTML);
		document.getElementById(replaceObj).innerHTML = "";
	var str2 = '' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str2);
}

function embedFlash_T(id, url, width, height, flashVars, wmode) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'transparent';
	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height+ '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<param name="allowScriptAccess" value="always" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '" name="' + id + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
			'<param name="allowScriptAccess" value="always" />' +
		'<!--<![endif]-->';
		document.write(str);
		//setScroll_GNB(dCarCnt);
		document.write(document.getElementById("tabControl").innerHTML);
		document.getElementById("tabControl").innerHTML = "";
	var str2 = '' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str2);
}


function embedFlash_L(id, url, width, height, flashVars, wmode) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'window';
	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height+ '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<param name="allowScriptAccess" value="always" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height+ '" name="' + id + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
			'<param name="allowScriptAccess" value="always" />' +
		'<!--<![endif]-->';
		document.write(str);
		document.write(document.getElementById("left_m").innerHTML);
		document.getElementById("left_m").innerHTML = "";
	var str2 = '' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str2);
}

function embedFlash_Main(id, url, width, height, flashVars, wmode) {
	if (!flashVars) flashVars = '';
	if (!wmode) wmode = 'window';
	var str = '' +
	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="' + width + '" height="' + height + '" id="' + id + '">' +
		'<param name="movie" value="' + url + '" />' +
		'<param name="wmode" value="' + wmode + '" />' +
		'<param name="FlashVars" value="' + flashVars + '" />' +
		'<param name="allowScriptAccess" value="always" />' +
		'<!--[if !IE]>-->' +
		'<object type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '" name="' + id + '">' +
			'<param name="wmode" value="' + wmode + '" />' +
			'<param name="FlashVars" value="' + flashVars + '" />' +
			'<param name="allowScriptAccess" value="always" />' +
		'<!--<![endif]-->';
		document.write(str);
		document.write(document.getElementById("flash_main").innerHTML);
		document.getElementById("flash_main").innerHTML = "";
	var str2 = '' +
		'<!--[if !IE]>-->' +
		'</object>' +
		'<!--<![endif]-->' +
	'</object>';
	document.write(str2);
}



// showroom trim moving2
var trim_cnt_GNB = 0;
var maxDisplayCnt_GNB = 0;
var move_px_GNB = 4;
var max_move_px_GNB = 20;
var movingState_GNB = false;
var strPosTop_GNB = 0;
var movetotal_GNB = 0;

function setScroll_GNB(maxCnt) {
	maxDisplayCnt_GNB = maxCnt;
	//alert(document.getElementById("trim_GNB").getElementsByTagName("li"));
	trim_cnt_GNB = document.getElementById("trim_GNB").getElementsByTagName("li").length;

	if (trim_cnt_GNB > maxCnt) {
		document.getElementById("arrowT_GNB").innerHTML = "<img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_up.gif\" alt=\"\" />";
		document.getElementById("arrowB_GNB").innerHTML = "<a href=\"javascript:moveGNB_Scroll('t');\"><img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_down_on.gif\" alt=\"\" /></a>";
	} else {
		document.getElementById("arrowT_GNB").innerHTML = "<img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_up.gif\" alt=\"\" />";
		document.getElementById("arrowB_GNB").innerHTML = "<img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_down.gif\" alt=\"\" />";
	}
}

function moveGNB_Scroll(direction) {
    if (movingState_GNB) { return; }
	else {movingState_GNB = true; }

	movetotal_GNB = 0;

	actMove_GNB(direction);
}

function actMove_GNB(direction) {
	if (movetotal_GNB < max_move_px_GNB) {
		if(direction == "t"){strPosTop_GNB = strPosTop_GNB - move_px_GNB;}
		else{strPosTop_GNB = strPosTop_GNB + move_px_GNB;}

		document.getElementById("GNB_MoveDiv").style.top = strPosTop_GNB + "px";
		movetotal_GNB += move_px_GNB;

		go = setTimeout ("actMove_GNB('" + direction + "')", 1)
	} else {
    	clearTimeout(go);
    	setBtn_GNB(direction);
    	movingState_GNB = false;
	}
}

function setBtn_GNB(direction) {
	if (document.getElementById("GNB_MoveDiv").style.top == "0px") {
		document.getElementById("arrowT_GNB").innerHTML = "<img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_up.gif\" alt=\"\" />";
		document.getElementById("arrowB_GNB").innerHTML = "<a href=\"javascript:moveGNB_Scroll('t');\"><img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_down_on.gif\" alt=\"\" /></a>";
	} else if (document.getElementById("GNB_MoveDiv").style.top == -((trim_cnt_GNB - maxDisplayCnt_GNB) * max_move_px_GNB) + "px") {
		document.getElementById("arrowT_GNB").innerHTML = "<a href=\"javascript:moveGNB_Scroll('b');\"><img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_up_on.gif\" alt=\"\" /></a>";
		document.getElementById("arrowB_GNB").innerHTML = "<img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_down.gif\" alt=\"\" />";
	} else {
		document.getElementById("arrowT_GNB").innerHTML = "<a href=\"javascript:moveGNB_Scroll('b');\"><img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_up_on.gif\" alt=\"\" /></a>";
		document.getElementById("arrowB_GNB").innerHTML = "<a href=\"javascript:moveGNB_Scroll('t');\"><img src=\"http://images.wwn.hyundai.com/Images/Web/common/top/prLeft_down_on.gif\" alt=\"\" /></a>";
	}
}
