﻿
//#########################################################################
/* RemoteCall link list*/
/* maked by larblue */
//#########################################################################


$(function() {
	$('.gnb ul').css('display', 'none');
	$('.gnb span').css('display', 'none');
	$('.feature p').css('display', 'none');
	$('.feature p:first').css('display', 'block');
	$('.notice li ul').css('display', 'none');
	$('.notice li ul:first').css('display', 'block');
	$('.left_menu ul ul ul').css('display', 'none');

	/* GNB Navigation Animation & Link */
	$('.gnb>li').mouseover(function() {
		$(this).children('a').addClass('over');
		$(this).children('ul').css('display', 'block');
		$(this).children('span').css('display', 'block');
	});
	$('.gnb>li').mouseout(function() {
		$(this).children('a').removeClass('over');
		$(this).children('ul').css('display', 'none');
		$(this).children('span').css('display', 'none');
	});
	/* Language Selection Animation & Link */
	$('.changelang').toggle(function() {
		$(this).addClass('changelangover');
		$(this).children('div').css('display', 'block');
	}, function() {
		$(this).removeClass('changelangover');
		$(this).children('div').css('display', 'none');
	});
	$('.changelang li').mouseover(function() {
		$(this).addClass('over');
	}).mouseout(function() {
		$(this).removeClass('over');
	});
	$('.changelang li a').click(function() {
		top.document.location.href = $(this).attr('href');
	});
	/* 3tap tip,product information, mov guide */
	$('.feature li').click(function() {
		$('.feature li a').removeClass('on');
		$(this).children('a:first').addClass('on');
		$('.feature li').children('p').css('display', 'none');
		var targetlist = $(this).children('a:first').attr('href');
		$(targetlist).children('p').css('display', 'block');
		return false;
	});
	/* main 3top Link */
	$('#f_menu01 p a').click(function() {
		location.href = $(this).attr('href');
	});
	$('#f_menu02 p a').click(function() {
		window.open($(this).attr('href'));
	});
	$('#f_menu03 p a').click(function() {
		window.open($(this).attr('href'));
	});
	$('dl.product a').click(function() {
		var linkPoint = $(this).attr('href');
		window.open(linkPoint, '', 'width=650,height=500,scrollbars=no');
		return false;
	});
	/* Notice Tab Animation */
	$('.notice>ul>li').click(function() {
		$('.notice li a').removeClass('on');
		$(this).children('a:first').addClass('on');
		$('.notice li ul').css('display', 'none');
		$(this).children('ul').css('display', 'block');
		return false;
	});
	$('.sublist li a').click(function() {
		location.href = $(this).attr('href');
	});

	/* left menu accodian */
	var bodyStyle = $('body').attr('class');
	var chapterNum = 0;
	var menuNum = 0;
	var submenuNum = 0;
	if (bodyStyle.length >= 7) {
		chapterNum = bodyStyle.substring(4, 5);
		menuNum = bodyStyle.substring(5, 6);
		submenuNum = bodyStyle.substring(6, 7);
	}
	var locationInfo = '.left_menu>ul>li:nth-child(' + chapterNum + ') ul>li:nth-child(' + menuNum + ')';
	
	var mainlistNum = locationInfo + ' ul';
	var listNum = locationInfo + '>a:first';
	var sublistNum = locationInfo + ' ul li:nth-child(' + submenuNum + ')';
	var leftMenu = '.leftmenu' + chapterNum;

	$('.left_menu>ul>li').css('display', 'none');
	$(leftMenu).css('display', 'block');
	$(mainlistNum).css('display', 'block');
	$(listNum).css('background', 'url(/contents/ko/images/common/left_sprite_bg.gif) 0 -552px').css('color', '#dd2120');
	$(sublistNum).addClass('over');
});

/*
===============================================================================
* Program Common
===============================================================================
*/
function chkUsrNm(arg){

    if (arg.trim().length < 2 ){
        return false;
    }else if ((arg == "none") || (arg == "nonenone") || (arg == "help") || (arg=="support") || (arg == "me") || (arg == "vs") || (arg == "yes") || (arg == "aaaaa")){
        return false;
    }else if ((arg == "asdf") || (arg == "asdfasdf") || (arg == "google") || (arg == "aaaa")){
        return false;
    }else{
        return true;
    }
}

// tel form check
function chkTelNm(arg){
    if (arg.trim().length < 6 ){
        return false;
    }else{
        for (var i=0; i<arg.length; i++)  {
            var chk = arg.substring(i,i+1);
            if(!chk.match(/[0-9]|[-]/)) {
                return false;
            }
        }
        return true;
    }
}