function showSignup(){
	window.open('http://billabong.us1.list-manage.com/subscribe?u=008505d43590f999553af9fd5&id=d33bf6778b');
}

function showStoreFinder(){
	window.open('http://www.billabong.com/eu/stores');
}

function regionSideNavCSS(){

}/*
 * In-Field Label jQuery Plugin
 * http://fuelyourcoding.com/scripts/infield.html
 *
 * Copyright (c) 2009 Doug Neiner
 * Dual licensed under the MIT and GPL licenses.
 * Uses the same license as jQuery, see:
 * http://docs.jquery.com/License
 *
 * @version 0.1
 */
(function($){$.InFieldLabels=function(b,c,d){var f=this;f.$label=$(b);f.label=b;f.$field=$(c);f.field=c;f.$label.data("InFieldLabels",f);f.showing=true;f.init=function(){f.options=$.extend({},$.InFieldLabels.defaultOptions,d);if(f.$field.val()!=""){f.$label.hide();f.showing=false};f.$field.focus(function(){f.fadeOnFocus()}).blur(function(){f.checkForEmpty(true)}).bind('keydown.infieldlabel',function(e){f.hideOnChange(e)}).change(function(e){f.checkForEmpty()}).bind('onPropertyChange',function(){f.checkForEmpty()})};f.fadeOnFocus=function(){if(f.showing){f.setOpacity(f.options.fadeOpacity)}};f.setOpacity=function(a){f.$label.stop().animate({opacity:a},f.options.fadeDuration);f.showing=(a>0.0)};f.checkForEmpty=function(a){if(f.$field.val()==""){f.prepForShow();f.setOpacity(a?1.0:f.options.fadeOpacity)}else{f.setOpacity(0.0)}};f.prepForShow=function(e){if(!f.showing){f.$label.css({opacity:0.0}).show();f.$field.bind('keydown.infieldlabel',function(e){f.hideOnChange(e)})}};f.hideOnChange=function(e){if((e.keyCode==16)||(e.keyCode==9))return;if(f.showing){f.$label.hide();f.showing=false};f.$field.unbind('keydown.infieldlabel')};f.init()};$.InFieldLabels.defaultOptions={fadeOpacity:0.5,fadeDuration:300};$.fn.inFieldLabels=function(c){return this.each(function(){var a=$(this).attr('for');if(!a)return;var b=$("input#"+a+"[type='text'],"+"input#"+a+"[type='password'],"+"textarea#"+a);if(b.length==0)return;(new $.InFieldLabels(this,b[0],c))})}})(jQuery);



/*
 THIRD FUNCTION
 getPageSize() by quirksmode.com
 
 return Array Return an array with page width, height and window width, height
*/
function ___getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
};

/*
 THIRD FUNCTION
 getPageSize() by quirksmode.com
 
 return Array Return an array with page width, height and window width, height
*/
function ___getPageScroll() {
	var xScroll, yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}
	arrayPageScroll = new Array(xScroll,yScroll);
	return arrayPageScroll;
};



function basicURLEncode(str) {
   var nstr = str;
   
   nstr = nstr.replace(/\&/g, '%26');
   nstr = nstr.replace(/\+/g, '%2B');
   nstr = nstr.replace(/\%20/g, '+');

   return nstr;
}
function URLEncode(str) {
   var nstr = escape(str);

   nstr = nstr.replace(/\+/g, '%2B');
   nstr = nstr.replace(/\%20/g, '+');

   return nstr;
}
function Set_Cookie( name, value, expires, path, domain, secure ){
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false;

	for ( i = 0; i < a_all_cookies.length; i++ ) {
		a_temp_cookie = a_all_cookies[i].split( '=' );
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		if ( cookie_name == check_name ) {
			b_cookie_found = true;
			if ( a_temp_cookie.length > 1 ) {
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found ) {
		return null;
	}
}

if (jQuery.browser.mozilla == true && jQuery.browser.version.substring(0, 5) == "1.8.1" && parseFloat(jQuery.browser.version.substring(6)) < 12) {
	var flashWithOpacity = false;
} else {
	var flashWithOpacity = true;
}

if (jQuery.browser.safari == true && jQuery.browser.version == "418.8" && Get_Cookie('SafariWarning') != "1") {
	alert("This site uses javascript that this version of Safari doesn't support.\nPlease consider updating your browser to the latest version.");
	Set_Cookie('SafariWarning', '1', 30, '/', '', '');
}






// JavaScript Document

var region = 'eu';
var siteBaseURL = 'http://www.billabong.com/girls/eu/';
var siteDomain = 'http://www.billabong.com/girls/eu';
var siteVer = 1;

function sendToFriend(sect, title){
	window.open('/girls/eu/html_gl/sendfriend.php?sect='+encodeURIComponent(sect)+'&ttl='+encodeURIComponent(title), 'sendToFriendWindow', 'resizable=0,width=500,height=460,scrollbars=1,status=1');
}
function printProduct(pid){
	window.open('/girls/eu/html_gl/product_print.php?id='+pid, 'productPrint', 'resizable=0,width=500,height=560,scrollbars=1,status=1');
}
function commentPolicy(){
	window.open('/girls/eu/html_gl/comment_policy.php', 'commentPolicy', 'resizable=0,width=500,height=560,scrollbars=1,status=1');
}
function downloadPopup(file, dlsize) {
	window.open('/girls/eu/html_gl/download.php?file='+file+'&size='+dlsize+'', '', 'resizable=0,width=680,height=380,scrollbars=1');
}







function updateMenuPos(){
	if (siteVer == 3 && siteDomain.indexOf('asia') == -1) {
		var mainNavWidth = $("#mainNav").width();
		if (mainNavWidth < 722 && mainNavWidth > 500) {
			extraMargin = Math.floor((722 - mainNavWidth)/($("#mainNav > li").length-1));
			$("#mainNav > li").each(
				function(){
					if (!$(this).hasClass('lastItem')) {
						$(this).css({
							'margin-right' : (0 + extraMargin)
						})
					}
				}
			)
		}
	}
	
	var wrapperOffset = $("#wrapper").offset().left;
	var headerMax = 930; 
	if (siteVer == 4) headerMax = 948; 
	$("#mainNav li > ul").each(
			function(){
				$(this).show();
				$(this).css({"left":"auto", "margin-left":0});
				
				var theWidth = $(this).width();
				var relPosX = $(this).offset().left - wrapperOffset;
				
				if (relPosX + theWidth > headerMax) {
					$(this).css({"margin-left": (0 - (relPosX + theWidth - headerMax))});
				}
				if (theWidth > 920) {
					$(this).css({"margin-left": (0 - (relPosX + (theWidth - 950)/2))});
				}
				
				$(this).hide();
			}
		);
}
function updateBackground(){
	$('#backImg').css({ height: 1 });
	$('#aboveBackImg').css({ height: 1 });
	var arrPageSizes = ___getPageSize();
	$('#backImg').css({ height: arrPageSizes[1] });
	$('#aboveBackImg').css({ height: arrPageSizes[1] });
}

$().ready(function(){
	updateMenuPos();
	
	$("#mainNav > li").hover(
			function(){
				$(this).find("ul:first").show();
			},
			function(){
				$(this).find("ul:first").hide();
			}
		);

	var arrPageSizes = ___getPageSize();
	$('#backImg').css({ height: arrPageSizes[1] });
	$('#aboveBackImg').css({ height: arrPageSizes[1] });
	$(window).resize(function() {
			updateBackground();
		});
	
	if (siteVer > 4) {
		$("#headerInner #searchForm label").show().inFieldLabels();
	}
});



var sfArr = new Array();

sfHover = function() {
	$('#mainNav li').hover(
		function(){
			$(this).addClass('sfhover');
		},
		function(){
			$(this).removeClass('sfhover');
		}
	);
	if (typeof(sfArr) != "undefined") {
		if (sfArr.length > 0) {
			for (s=0; s<sfArr.length; s++) {
				$('#'+sfArr[s][0]+' '+sfArr[s][1]+'').hover(
					function(){
						$(this).addClass('sfhover');
					},
					function(){
						$(this).removeClass('sfhover');
					}
				);
			}
		}
	}
}

$(document).ready(function(){  
	sfHover();
	updateMenuPos();
	updateBackground();
});
$(window).load(function(){
	updateMenuPos();
	updateBackground();
});

function validateEmail(form_id,email) {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = document.forms[form_id].elements[email].value;
	if(reg.test(address) == false) {
		return false;
	} else {
		return true;
	}
}




