//anchor
$(function(){
    $('a[href*=#], area[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 500);
                return false;
            }
        }
    });
});


//externalLinks
$(function(){
  $('a.blank').click(function(){
    window.open(this.href);
    return false;
  })
});


//img rollover
$(function(){
	var postfix = '_on';
	$('.rollover a img,  a.rollover img,  img.rollover').not('[src*="'+ postfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(
			function() {
				img.attr('src', src_on);
			},
			function() {
				img.attr('src', src);
			}
		);
	});
});


//faq
$(function(){
	$(".faq-block dt").hover(function(){
		$(this).css("cursor","pointer"); 
	},function(){
		$(this).css("cursor","default"); 
		});
	$(".faq-block dd").css("display","none");
	$(".faq-block dt").click(function(){
		$(this).next().slideToggle("fast");
		});
});

$(function(){
var target=$("dd",".faq-block"); 

   $(".faq-all a").click(function () {
     if (target.is(":hidden")) {
		target.slideDown();
     } else {
		target.slideUp();
     }
   })
 });


//first-child , last-child
$(function(){
	$(":first-child",".fl-check").addClass("firstChild");
	$(":last-child",".fl-check").addClass("lastChild");
});

//stripe
$(function(){
	$(".stripe tr:nth-child(even) , .stripe li:nth-child(even)").addClass("even");
	$(".stripe tr:nth-child(odd) , .stripe li:nth-child(odd)").addClass("odd");
});


//window
function openWin(url){
  newWin = window.open(url,'popup','width=600,height=700,scrollbars=yes,status=no,toolbar=no,location=no,menubar=no,resizable=yes');
  newWin.focus();
}