/*
 * requires:jQuery v1.6.2 later
 * name:settings.js
 * author:Manabu Kushimoto(web-park.org)
 */
 
jQuery(function($){
 
//外部リンクブランク
var siteURL="pandm.co.jp";
$.fn.targetBlank=function(){
var $t=$(this),thisURL=$t.attr("href");
$t.click(function(){
window.open(thisURL,"_blank");
return false;
});
}
$("a[href^='http://'],a[href^='https://'],a.blank").not($("a[href^='http://"+siteURL+"']")).not($("a[href^='http://www."+siteURL+"']")).each(function(){$(this).targetBlank();});

//擬似セレクタ - only first-child and last-child
$.fn.ElementSelecter=function(){
var $t=$(this),$children=$t.children();
$children.each(function(i){
var lastNum=new Number($children.length)-1;
$children.eq(0).addClass("first-child");
$children.eq(lastNum).addClass("last-child");
});
};
$(".pageNav").each(function(){ $(this).ElementSelecter(); });

//セレクタに正規表現を利用するプラグイン
$.expr[':'].regex = function(elem, index, match) {
var matchParams = match[3].split(','),
validLabels = /^(data|css):/,
attr = {
method: matchParams[0].match(validLabels) ? 
matchParams[0].split(':')[0] : 'attr',
property: matchParams.shift().replace(validLabels,'')
},
regexFlags = 'ig',
regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
return regex.test(jQuery(elem)[attr.method](attr.property));
}

//ページ内スクロール
$.fn.pageScroll=function(){
var $t=$(this);
$t.click(function(){
var Hash=$(this.hash),HashOffset=$(Hash).offset().top;
$("html,body").animate({
scrollTop: HashOffset
},600);
return false;
});
}
$("a:regex(href,^#[a-z,A-Z])").pageScroll();




});


