$(function(){
	$("a img").hover(function(){
		$(this).fadeTo(200, 0.5);
		$(this).fadeTo(200, 1);
	},function(){
		$(this).fadeTo(200, 1);
	});
	
	var ua =navigator.userAgent;
	if(ua.indexOf('iPhone') > -1 || ua.indexOf('iPad') > -1 || ua.indexOf('iPod')  > -1 || ua.indexOf('Android')  > -1){
		$("head").append('<link rel="stylesheet" href="http://www.office-r3.com/common/css/ipod_ipad.css" type="text/css" />');
		}else{
		$("head").append('<link rel="stylesheet" href="http://www.office-r3.com/common/css/scrollbar.css" type="text/css" />');
		//$("a[href*='#']").easingScroll({easing: "easeInOutExpo",duration: 1200});
	}
	/*マウスオーバー*/
	var postfix = '_on';
	$('ul#navMain a').not('[src*="'+ postfix +'."]').each(function() {
	
		var a = $(this);
		
		var img = a.children();
		var src = img.attr('src');
		
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		//$('<img>').attr('src', src_on);
		
		//console.log(src_on);
		
		a.mouseover(function(){
			$(this).not('.current').stop().animate({
				backgroundPosition: "-300px 0px"
				},200,"easeInCubic",function() {
					img.attr('src', src_on);
					//console.log(src_on);
					});
			
			}).mouseout(function(){
				$(this).not('.current').stop().animate({
					backgroundPosition:"-600px 0px"
					}, 
					200,"easeInCubic",function(){
					img.attr('src', src);
					//console.log(src);
				$(this).css({
					backgroundPosition: "-600px 0px"
					})
			})
			
		})
	});
	if($.fn.popupwindow){
		$(".popupwindow").popupwindow(profiles);
		}
});

		
window.log = function(){
  log.history = log.history || [];   
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);
