function BMdelicious(_url,_title){ISMEDIAns.util.bm.delicious(_url,_title);}
function BMdigg(_url,_title){ISMEDIAns.util.bm.digg(_url,_title);}
function BMhatena(_url,_title){ISMEDIAns.util.bm.hatena(_url,_title);}
function BMnewsing(_url,_title){ISMEDIAns.util.bm.newsing(_url,_title);}
function BMyahoo(_url,_title){ISMEDIAns.util.bm.yahoo(_url,_title);}
function BMgoo(_url,_title){ISMEDIAns.util.bm.goo(_url,_title);}
function BMlivedoor(_url,_title){ISMEDIAns.util.bm.livedoor(_url,_title);}
function BMstumbleupon(_url,_title){ISMEDIAns.util.bm.stumbleupon(_url,_title);}
function BMgoogle(){ISMEDIAns.util.bm.google();}
function BMgoogleR(){ISMEDIAns.util.bm.googleR();}
function BMfriendfeed(_url,_title){ISMEDIAns.util.bm.friendfeed(_url,_title);}
function BMbuzzurl(_url,_title){ISMEDIAns.util.bm.buzzurl(_url,_title);}
function BMfc2(_url,_title){ISMEDIAns.util.bm.fc2(_url,_title);}
function BMiza(_url){ISMEDIAns.util.bm.iza(_url);}

function showWindow(url,w,h){ISMEDIAns.util.openWindow(url,w,h);}

// Namespace
if(typeof(NUMBERns)=='undefined'){
 var NUMBERns={
  util:{},      // Other Utility Function
  cls:{},       // Class
  show:{},      // Element show Function
  mv:{},        // Element move Function
  cb:{},        // Callback Function
  eom:null      // End Mark
 };
}

NUMBERns.util.onColor=function(o){
 jQuery(o).css({
  'color':'#000000',
  'backgroundColor':'#FFFFFF'
 });
}
NUMBERns.util.offColor=function(o){
 jQuery(o).css({
  'color':'#FFFFFF',
  'backgroundColor':'#333333'
 });
}

NUMBERns.util.onColor2=function(o){
 jQuery(o).css({
  'color':'#999999',
  'backgroundColor':'#FFFFFF'
 });
}
NUMBERns.util.offColor2=function(o){
 jQuery(o).css({
  'color':'#999999',
  'backgroundColor':'#ffffff'
 });
}

// Read Cookie
NUMBERns.util.rCookie = function(_name) {
 var neq = _name + '=';
 var ca = document.cookie.split(';');
 for(var i=0; i<ca.length; i++) {
  var c = ca[i];
  while (c.charAt(0)==' ') { c = c.substring(1,c.length); }
  if (c.indexOf(neq) == 0) { return c.substring(neq.length,c.length); }
 }
 return null;
};
// Write Cookie
NUMBERns.util.wCookie = function(_name,_value,_expire) {
 var expires = '; expires=' + _expire.toGMTString();
 var domain = '; domain=' + location.hostname;
 document.cookie = _name + '=' + _value  + expires + domain + '; path=/';
};

// Common Startups
jQuery(function(){
 // right click ctrl
 jQuery('img').bind("contextmenu",function(e){
  return false;
 });

 // Search Input
 jQuery('#keyword').focus(function(){
  if(this.value == this.defaultValue) {this.value = '';}
  NUMBERns.util.onColor(this);
 }).blur(function(){
  if(jQuery.trim(this.value) == '') {this.value = this.defaultValue;}
  NUMBERns.util.offColor(this);
 });

 // Search Input2
 jQuery('#keyword2').focus(function(){
  if(this.value == this.defaultValue) {this.value = '';}
  NUMBERns.util.onColor2(this);
 }).blur(function(){
  if(jQuery.trim(this.value) == '') {this.value = this.defaultValue;}
  NUMBERns.util.offColor2(this);
 });

 try{
 
 jQuery('#photo-area1').css({
  'position':'absolute',
  'left':'0px',
  'top':'0px',
  'width':'237px',
  'height':'380px'
 });
 jQuery('#photo-area1 a').css({'position':'absolute'});
 
 jQuery('#photo-area2').css({
  'position':'absolute',
  'left':'238px',
  'top':'0px',
  'width':'237px',
  'height':'380px'
 });
 jQuery('#photo-area2 a').css({'position':'absolute'});
 
 jQuery('#photo-area3').css({
  'position':'absolute',
  'left':'476px',
  'top':'0px',
  'width':'237px',
  'height':'380px'
 });
 jQuery('#photo-area3 a').css({'position':'absolute'});

 jQuery('#photo-area1 a').hide();
 jQuery('#photo-area1 a:eq(0)').show();
 
 jQuery('#photo-area2 a').hide();
 jQuery('#photo-area2 a:eq(0)').show(); 
 
 jQuery('#photo-area3 a').hide();
 jQuery('#photo-area3 a:eq(0)').show();

 var photoCount1 = jQuery('#photo-area1 a').size();
 var photoCount2 = jQuery('#photo-area2 a').size();
 var photoCount3 = jQuery('#photo-area3 a').size();
 
 setTimeout(function(){
	 jQuery('#photo-area1 a').eq(0).fadeOut(2000);
	 jQuery('#photo-area1 a').eq(1).fadeIn(2000);
 },0);
 setTimeout(function(){
	 jQuery('#photo-area2 a').eq(0).fadeOut(2000);
	 jQuery('#photo-area2 a').eq(1).fadeIn(2000);
 },1000);
 setTimeout(function(){
	 jQuery('#photo-area3 a').eq(0).fadeOut(2000);
	 jQuery('#photo-area3 a').eq(1).fadeIn(2000);
 },2000);

 var showIndex1 = 1;
 var nextIndex1 = 1;
  
 setTimeout(function(){
 setInterval(function(){
					  
  showIndex1 = nextIndex1;
  if ((photoCount1 % 2) == 0){
   nextIndex1 = (photoCount1 - nextIndex1)==2 ? 1 : (photoCount1 - nextIndex1)==1 ? 0 : nextIndex1 + 2;
  } else {
   nextIndex1 = (photoCount1 - nextIndex1)==1 ? 1 : (photoCount1 - nextIndex1)==2 ? 0 : nextIndex1 + 2;
  }
  jQuery('#photo-area1 a').eq(showIndex1).fadeOut(2000);
  jQuery('#photo-area1 a').eq(nextIndex1).fadeIn(2000);
 },3000);
},0);
 
  
 var showIndex2 = 1;
 var nextIndex2 = 1;
 setTimeout(function(){
  setInterval(function(){
   showIndex2 = nextIndex2;
   if ((photoCount2 % 2) == 0){
    nextIndex2 = (photoCount2 - nextIndex2)==2 ? 1 : (photoCount2 - nextIndex2)==1 ? 0 : nextIndex2 + 2;
   } else {
    nextIndex2 = (photoCount2 - nextIndex2)==1 ? 1 : (photoCount2 - nextIndex2)==2 ? 0 : nextIndex2 + 2;
   }
   
   jQuery('#photo-area2 a').eq(showIndex2).fadeOut(2000);
   jQuery('#photo-area2 a').eq(nextIndex2).fadeIn(2000);
  },3000);
 },1000);
 
 var showIndex3 = 1;
 var nextIndex3 = 1;
setTimeout(function(){
  setInterval(function(){
   showIndex3 = nextIndex3;
   if ((photoCount3 % 2) == 0){
    nextIndex3 = (photoCount3 - nextIndex3)==2 ? 1 : (photoCount3 - nextIndex3)==1 ? 0 : nextIndex3 + 2;
   } else {
    nextIndex3 = (photoCount3 - nextIndex3)==1 ? 1 : (photoCount3 - nextIndex3)==2 ? 0 : nextIndex3 + 2;
   }
   jQuery('#photo-area3 a').eq(showIndex3).fadeOut(2000);
   jQuery('#photo-area3 a').eq(nextIndex3).fadeIn(2000);
  },3000);
  },2000);

 }catch(err){}

 // SlideShow
 try{
 jQuery(".main .slideshow").jCarouselLite({
    btnNext: ".next",
    btnPrev: ".prev",
    visible: 5,
    speed: 900,
    //easing: 'easeOutQuad',
    easing: 'linear',
    circular:true,
    scroll:5
 });
 }catch(err){}

 try{
 jQuery(".pg-main .pg-slideshow").jCarouselLite({
    btnNext: ".pg-next",
    btnPrev: ".pg-prev",
    visible: 4,
    speed: 900,
    //easing: 'easeOutQuad'
    easing: 'linear',
    circular:true,
    scroll:4
 });
 }catch(err){}

 // popup Window
 try{
   jQuery('a.popup').bind("click",function(e){
     var w = 800;
     var h = 600;
     try{
      w = this.rel.split(',')[0];
      h = this.rel.split(',')[1];
     }catch(err){}
     var opt = 'width=' + w + ',height=' + h + 'location=yes,menubar=no,status=no,scrollbars=yes';
     NUMBERns.cls.window = window.open(this.href,'popupwindow',opt);
     NUMBERns.cls.window.focus();
     return false;
   });
 }catch(err){}

 // BIG LINK
 try{
   jQuery('div.score,div.score-detail').css({'cursor':'pointer'});
   jQuery('div.score ul li a,div.score-detail ul li a').each(function(){
     var link = jQuery(this).attr('href');
     jQuery(this).parent().click(function(){
       window.open(link,'_self');
       return false;
     });
   });
 }catch(err){}

 // for fancybox
 try{
  if (jQuery('a.overlay').length) {
   jQuery('a.overlay').fancybox({
    titlePosition:'over'
   });
  }
 }catch(e){}

 // feedback recommend
 try{
  if (jQuery('a.pushrecommend').length){
   jQuery('a.pushrecommend').click(function(){
     var t = this;
     var url = this.href;
     var o = jQuery(this).siblings('.ithink-toolchip')[0];
     var oo = jQuery(o).find('span')[0];
     jQuery.get(this.href,null,function(data){
      var i = jQuery(oo).html();
      i = parseInt(i)+1;
      jQuery(oo).html(i);
      jQuery(t).hide('slow');
     });
     return false;
   });
  };
 }catch(err){}

});


