/*
 * common.js
 *
 */
 


// onload event set
//
window.onload = function () { 
	if(typeof fontSize == "object"){
		fontSize.init();
	}
	/*if(typeof swapImage == "object"){
		swapImage.init();
	}*/
}


// popup
//
function fWinClosed(winVar) {
var ua = navigator.userAgent
	if( !!winVar )
		if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 ) && ua.indexOf('Win')!=-1 ) 
				return winVar.closed
			else return typeof winVar.document  != 'object'
	else return true
}
function fOpenWin(theURL,targetName,theW,theH) {
	if(fWinClosed(tWin)){
		var tWin = window;
		tWin = open(theURL,targetName,'scrollbars=yes,resizable=yes,toolbar=no,location=yes,directories=no,status=yes,menubar=no,width='+theW+',height='+theH+'');
		tWin.focus();
	}
}


// easing
//
jQuery.easing.quart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

// page scroll
//
jQuery(document).ready(function(){
	jQuery('a[href*=#move]').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var $target = jQuery(this.hash);
            $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
								jQuery('html, body').stop(true,true).animate({scrollTop: targetOffset}, 1200 , 'quart',function(){$(this).unbind("mousewheel DOMMouseScroll");})
											.bind("mousewheel DOMMouseScroll",function(){
												$(this).queue([]).stop();
												$(this).unbind("mousewheel DOMMouseScroll");
								});
                return false;
            }
        }
    });
	jQuery('area[href*=#move]').click(function() {
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
            var $target = jQuery(this.hash);
            $target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
								jQuery('html, body').stop(true,true).animate({scrollTop: targetOffset}, 1200 , 'quart',function(){$(this).unbind("mousewheel DOMMouseScroll");})
											.bind("mousewheel DOMMouseScroll",function(){
												$(this).queue([]).stop();
												$(this).unbind("mousewheel DOMMouseScroll");
								});
                return false;
            }
        }
    });
});

// slideshow
function fSlideShow(href) {

	$("div.dThumbnailList > ul li img").each(function(i, item){
			var a = $(item).parent().get(0);
			var href_this = $(a).attr('href');
			var src = $(this).attr('src');

			if(href == href_this)	{
				$(item).attr('class', 'iActive');

			}
			else {
				$(item).attr('class', '');

			}
	});
	
	return false;
}

$(function(){
	if(typeof swapImage == "object"){
		swapImage.init();
	}
});



//dropdownmenu

/*if (navigator.userAgent.indexOf('iPhone') > 0 || navigator.userAgent.indexOf('iPad') > 0 || navigator.userAgent.indexOf('iPod') > 0 || navigator.userAgent.indexOf('Android') > 0) {

}else{*/
	$(function(){
	var postfix = '_ov';
	
		$("ul li#liNavMens .gnImg").each(function() {
			var img1 = $(this);
			var src = img1.attr('src');
			var src_ov = src.substr(0, src.lastIndexOf('_df.'))
								 + postfix
								 + src.substring(src.lastIndexOf('.'));
			$("ul li#liNavMens").hover(function(){
				img1.attr('src', src_ov);
				
				$(this).css("cursor", "pointer");
				$("#dDropMens").css("visibility", "visible");
				
				return false;
			},function(){
				img1.attr('src', src);
				$("#dDropMens").css("visibility", "hidden");
			
			});
		});	
		$("ul li#liNavLadies .gnImg").each(function() {
			var img2 = $(this);
			var src = img2.attr('src');
			var src_ov = src.substr(0, src.lastIndexOf('_df.'))
								 + postfix
								 + src.substring(src.lastIndexOf('.'));
			$("ul li#liNavLadies").hover(function(){
				img2.attr('src', src_ov);
				$(this).css("cursor", "pointer");
				$("#dDropLadies").css("visibility", "visible");
				
			},function(){
				img2.attr('src', src);
				$("#dDropLadies").css("visibility", "hidden");
				
			
			});
			
		});	
	
		
	
	});
/*}*/	


