
$(document).ready(function(){
	$('a[rel="works"]').click(function(){
		var win;
		if(screen.width < 1025){
			win=window.open(this.href, "works","width=970,height=620,location=no,status=no,menubar=no, toolbar=no, scrollbars=yes,resizable=yes");
		}else{
			win=window.open(this.href, "works","width=1058,height=620,location=no,status=no,menubar=no, toolbar=no, scrollbars=yes,resizable=yes");
		}
		win.focus();
		return false;
	});
	$('a[rel="dbook"]').click(function(){
		var win;
		win=window.open(this.href, "dbook","width=940,height=635,menubar=no, toolbar=no, scrollbars=yes,resizable=yes");
		win.focus();
		return false;
	});

	$('#footerContent .am a').hover(
		function(){$(this).find("img").fadeOut(1);},
		function(){$(this).find("img").fadeIn(1);}
	);
    
    /*Alternative link for Mobile devices*/
    $('a[href*="/works/index.html"]').altLink();
    $('a[href*="/dbook/index.html"]').altLink();
    $('a[href*="/works/index_am.html"]').altLink({
        url:'http://www.hophouse.co.jp/the_hop_house/',
        openType:'_blank'
    });
    
});



/*!
 * NFAL altlink for Mobile devices - jQuery Plugin
 *
 * Copyright 2012, Near Future Arts Lab Co.,Ltd.
 * Released under the MIT License.
 *
 * Version: 0.1.2 (31/01/2012)
 */

(function($) {
	$.altLink = function(element, options) {
		var defaults = {
			targetUA: ['iPhone','iPad','iPod','Android','Windows Phone'],
			url: 'http://www.hophouse.co.jp/nonflash/',
            openType: 'nonflash'
		}
		
		var al = this;
			al.set = {};
		
		var $element = $(element),
			element = element,
			targetUA,
			url,
            openType;
        
		
		al.init = function() {
			al.set = $.extend({}, defaults, options);
			
			targetUA = al.set.targetUA;
			url = al.set.url;
            openType = al.set.openType;			
        }
        al.main = function() {
            var agent = navigator.userAgent;
            var chkpoint = targetUA.length;
            
            for (var val in targetUA){
                if( agent.indexOf(targetUA[val]) != -1){
                    chkpoint --;
                }
            }
            if( chkpoint != targetUA.length){
                $(element).attr('href',url).attr('target',openType);
            }
            
        }
		al.init();
        al.main();	
    }
	
	$.fn.altLink = function(options) {
		return this.each(function() {
			if (undefined == $(this).data('altLink')) {
				var sc = new $.altLink(this, options);
				$(this).data('altLink', sc);
			}
		});
	}


})(jQuery);

/**************************************************************************/
