$(function() {
	$('.pagetop a').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $('#head');
			target = target.length && target;
			if (target.length) {
				var sclpos = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
});



$.auto = {
	init: function() {
		for (module in $.auto) {
			if ($.auto[module].init)
				$.auto[module].init();
		}
	}
};

$(document).ready($.auto.init);

$.auto.hide = {
	init: function() {
		$('.Hide').hide();
	}
};

$.auto.hover = {

	init: function() {
		$('.Hover')
			.bind('mouseover', this.enter)
			.bind('mouseout', this.exit)
			.each(this.preload);
	},

	preload: function() {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},

	enter: function() {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},

	exit: function() {
		this.src = this.src.replace(/^(.+)_over(\.[a-z]+)$/, "$1$2");
	}
};

$.auto.submit = {
	init: function() {
		$('SELECT.Submit').bind('change', this.on_change);
	},

	on_change: function() {
		if (this.value) this.form.submit();
	}
};

$.auto.select = {
	init: function() {
		$('LABEL.Select').each(this.label_action);
		$('INPUT.Select').bind('click', function(){ this.select(); });
	},

	label_action: function() {
		var field = $('#'+this.htmlFor).get(0);
		if (field && field.focus && field.select) {
			$(this).bind('click', function(){ field.focus(); field.select(); });
		}
	}
};

$.auto.tabs = {

	init: function() {

		$('.Tabs').each(function(){
			var f = $.auto.tabs.click;
			var group = this;
			$('.Tab', group).each(function(){
				this.group = group;
				$(this).click(f);
				$('#'+this.id+'_body').hide();
			}).filter(':first').trigger('click');
		});

	},

	click: function() {
		var tab = $('#'+this.id+'_body').get(0);
		$('.Tab', this.group).each(function(){
			$(this).removeClass('Active');
			$('#'+this.id+'_body').hide();
		});

		$(this).addClass('Active');
		$(tab).show();
		this.blur();

		return false;
	}

};



$(function(){
$('.popup').click(function(){

var url = $(this).parent().attr("href");
var name = $(this).parent().attr("id");
var windownames = "win"+name;
window.open(url,windownames,"width=300,height=240, menubar=no, toolbar=no, scrollbars=yes");
return false;
});
});

$(function(){
$('.reopener').click(function(){
	window.close();
	window.opener.location.href = window.opener.location.href;
});
});

$(function(){
$('.close').click(function(){
	window.close();
});
});






/-----------------------faq--------------------------/
$(function() {
	$('#faq dt a').click(function() {
        var faqid="";
        var id = $(this).attr("href");
        var id = id.split("#");
        faqid = id[1];
        
        $("#faq dd#"+faqid).slideToggle('medium');
        
        if($(this).attr('class') == "open" || $(this).attr('class') == "")
        {
            $(this).attr('class','close');
        }
        else if($(this).attr('class') == "close")
        {
            $(this).attr('class','open');
        }
		return false;
	});
});




$(function() {
	$('#miniimgbox img').click(function() {
        
        var changecom="";
        var img = $(this).parent().attr("href");
        $("#mainbox img").attr("src",img)
		return false;
	});
});


$(document).ready(function () {
    $('#left_contents .taglist .button img').click(function () {
	$('#left_contents .taglist ul.more').slideToggle('medium');
    if($(this).attr('class') == 'open')
    {
        var imgclass = 'close';
        $(this).attr('class',imgclass);
    }
    else
    {
        var imgclass = 'open';
        $(this).attr('class',imgclass);
    }
    
    });
	$('#left_contents .taglist li a').mouseover(function () {
	$(this).animate({ paddingLeft: "20px" }, 50 );
    });
	$('#left_contents .taglist li a').mouseout(function () {
	$(this).animate({ paddingLeft: "10px" }, 50 );
    });
});

$(document).ready(function () {
    
	$('#left_contents .category li a').mouseover(function () {
	$(this).animate({ paddingLeft: "26px" }, 50 );
    });
	$('#left_contents .category li a').mouseout(function () {
	$(this).animate({ paddingLeft: "16px" }, 50 );
    });
});








