/**START GLOBAL FUNCTIONS**/
var showAdd;

function goods_over(id) {
	MM_swapImage(id,'','/images/img_br/130X98_.png',1);
	document.getElementById("price_"+id).style.visibility = "visible";
    document.getElementById("new_"+id).style.color = "#851012";
	document.getElementById("name_link_"+id).style.color = "#59715B";
}
function goods_out(id) {
	MM_swapImgRestore();
	document.getElementById("price_"+id).style.visibility = "hidden";
	document.getElementById("new_"+id).style.color = "#A95B48";
	document.getElementById("name_link_"+id).style.color = "#78957b";
}


function goods_over_list(id) {
	MM_swapImage(id,'','/images/img_br/215X161_.png',1);
    document.getElementById("new_"+id).style.color = "#851012";
	document.getElementById("name_link_"+id).style.color = "#59715B";
}

function goods_out_list(id) {
	MM_swapImgRestore();
	document.getElementById("new_"+id).style.color = "#A95B48";
	document.getElementById("name_link_"+id).style.color = "#78957b";
}

//показ формы добавления комментария
function comments(id)
{
	id = 'comments'+id;
	var obj = document.getElementById(id);
	var val = (obj.className == 'show') ? 'hidden' : 'show';
	obj.className = val;
	location.href="#comment";
}


function fixPNG(element)

{

	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))

	{

		var src;

		

		if (element.tagName=='IMG')

		{

			if (/\.png$/.test(element.src))

			{

				src = element.src;

				element.src = "/images/spacer.gif";

			}

		}

		else

		{

			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)

			if (src)

			{

				src = src[1];

				element.runtimeStyle.backgroundImage="none";

			}

		}

		

		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";

	}

}

function meShowImg(id, dir){

  window.open(dir+'/photo/element.php?ID='+id,'','resizable=yes, status=no, menubar=no, width=900, height=830, scrollbars=yes, toolbar=0;');

}

function meShowImgGoods(id, dir){

  window.open(dir+'/store/photo.php?ID='+id,'','resizable=yes, status=no, menubar=no, width=900, height=830, scrollbars=yes, toolbar=0;');

}

function ShowPlayer(){

  window.open('/player.php','player','resizable=yes, status=no, menubar=no, width=480, height=120, scrollbars=no, toolbar=0;');

}

rnd.today=new Date();

rnd.seed=rnd.today.getTime();



function rnd() {

	rnd.seed = (rnd.seed*9301+49297) % 233280;

	return rnd.seed/(233280.0);

}



function rand(number) {

	return Math.ceil(rnd()*number);

}



imgOn = new Array();

imgOff = new Array();



function hideSort(){

	$hide_sort = true;

	//if (sortTimer) window.clearTimeout(sortTimer);

	setTimeout("do_hideSort()", 300);

}

function do_hideSort(){

	var obj = document.getElementById('sort');

	//var val = (obj.className == 'show') ? 'hidden' : 'show';

	if($hide_sort) obj.className = 'hidden';

}

function makeSort(type){

	$hide_sort = false;

	clearTimeout();

	var obj = document.getElementById('sort');

	//var val = (obj.className == 'show') ? 'hidden' : 'show';

	obj.className = 'show';

}



function hideSort_bot(){

	$hide_sort_bot = true;
	//if (sortTimer) window.clearTimeout(sortTimer);
	setTimeout("do_hideSort_bot()", 300);

}

function do_hideSort_bot(){

	var obj = document.getElementById('sort_bot');
	//var val = (obj.className == 'show') ? 'hidden' : 'show';
	if($hide_sort_bot) obj.className = 'hidden';

}

function makeSort_bot(type){
	
	$hide_sort_bot = false;
	clearTimeout();
	var obj = document.getElementById('sort_bot');
	//var val = (obj.className == 'show') ? 'hidden' : 'show';
	obj.className = 'show';
	
}



function send2friend()
{
	
	var obj = document.getElementById('send_window');
	var val = (obj.className == 'show') ? 'hidden' : 'show';
	obj.className = val;
	
}


var authFormWindow = {

	form_window: null,
	overlay : null,
	form_window_id : "send_window",
	login_field_id : "email1",

	ShowLoginForm : function()
	{

		document.getElementById("send_window").style.display = "block";

		if (this.GetOpacityProperty())
			this.CreateOverlay();

		var loginField = document.getElementById(this.login_field_id);
		if (loginField)
		{
			loginField.focus();
			loginField.select();
		}
		return false;
	},

	CloseLoginForm : function()
	{
		document.getElementById("send_window").style.display = "none";
		if (this.overlay)
			this.overlay.style.display = "none";
		return false;
	},

	CreateOverlay : function()
	{
		if (!this.overlay)
		{
			this.overlay = document.body.appendChild(document.createElement("DIV"));
			this.overlay.className = "login-form-overlay";

			var _this = this;
			this.overlay.onclick = function() {_this.CloseLoginForm()};
		}

		var windowSize = this.GetWindowScrollSize();

		this.overlay.style.width = windowSize.scrollWidth + "px";
		this.overlay.style.height = windowSize.scrollHeight + "px";
		this.overlay.style.display = "block";
	},

	GetOpacityProperty : function()
	{
		if (typeof document.body.style.opacity == 'string')
			return 'opacity';
		else if (typeof document.body.style.MozOpacity == 'string')
			return 'MozOpacity';
		else if (typeof document.body.style.KhtmlOpacity == 'string')
			return 'KhtmlOpacity';
		else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5)
			return 'filter';

		return false;
	},

	GetWindowScrollSize : function(pDoc)
	{
		var width, height;
		if (!pDoc)
			pDoc = document;

		if ( (pDoc.compatMode && pDoc.compatMode == "CSS1Compat"))
		{
			width = pDoc.documentElement.scrollWidth;
			height = pDoc.documentElement.scrollHeight;
		}
		else
		{
			if (pDoc.body.scrollHeight > pDoc.body.offsetHeight)
				height = pDoc.body.scrollHeight;
			else
				height = pDoc.body.offsetHeight;

			if (pDoc.body.scrollWidth > pDoc.body.offsetWidth || 
				(pDoc.compatMode && pDoc.compatMode == "BackCompat") ||
				(pDoc.documentElement && !pDoc.documentElement.clientWidth)
			)
				width = pDoc.body.scrollWidth;
			else
				width = pDoc.body.offsetWidth;
		}
		return {scrollWidth : width, scrollHeight : height};
	}
}


function MM_findObj(n, d) {

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;

}



function MM_swapImage() {

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function MM_swapImgRestore() {

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

  }



function MM_preloadImages() {

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_openBrWindow(theURL,winName,features) {

  var winObj;

  winObj = window.open(theURL,winName,features);

}



function nvp_struct(){

		var args = nvp_struct.arguments;

		this.nvp_qvpair = args[0];

		this.nvp_var = args[1];

		this.nvp_value = args[2];

}



var nvp_array = new Array;

function nvp_parse(){

	var querystring = location.search; nvp = querystring.indexOf('&'); searchstring = "true"; prev_nvp = 1; x = 0;

	do {

	if (nvp == -1){nvp = querystring.length; searchstring = "false";}

	var nvp_qvpair = querystring.substring(prev_nvp, nvp); nvp_var = nvp_qvpair.substring(0, nvp_qvpair.indexOf('=')); nvp_value = nvp_qvpair.substring(nvp_qvpair.indexOf('=')+1);

	nvp_array[x] = new nvp_struct(nvp_qvpair,nvp_var,nvp_value); querystring = querystring.substring(nvp + 1,querystring.length);

	if(querystring == null){searchstring = "false"} else {var prev_nvp = 0;		nvp = querystring.indexOf('&');		x++;}

	} while (searchstring == "true")

}



function nvp_get(){

	var args = nvp_get.arguments; nvpsearch = args[0]; nvpvalue = "noval"; nvp_length = nvp_array.length;

	for (var x = 0; x != nvp_length; x++){

		if(nvp_array[x].nvp_var == nvpsearch){nvpvalue = nvp_array[x].nvp_value};

	}

return nvpvalue;

}



function MM_validateForm() {

var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);

	if (val) { nm=val.name; if ((val=val.value)!="") {

	  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

		if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

	  } else if (test!='R') {

		if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

		if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

		  min=test.substring(8,p); max=test.substring(p+1);

		  if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

	} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

  } if (errors) alert('The following error(s) occurred:\n'+errors);

  document.MM_returnValue = (errors == '');

}



var numChars = 250;

function notTooBig() {

		if (document.pcard.message.value.length > numChars+1) {

		document.pcard.message.value = document.pcard.message.value.substring(0,numChars-1);

		alert("You cannot enter more than 250 characters in the message field."); }

}



var hostName = location.host;



var serverHostname = 'http://'+hostName;



var globalStoreId = readCookie('myStore');

if(globalStoreId == null){

	var globalStoreId = 10051

}

var globalCatalogId = 10901

var globalCatgroupId1 = 12202

var globalCatgroupId2 = 12203

var globalCatgroupId3 = 12204

var globalCatgroupId4 = 12205



var globalTopNavLink1 = serverHostname + '/webapp/wcs/stores/servlet/CategoryDisplay?langId=-1&storeId=' + globalStoreId + '&catalogId=' + globalCatalogId + '&categoryId=' + globalCatgroupId1

var globalTopNavLink2 = serverHostname + '/webapp/wcs/stores/servlet/CategoryDisplay?langId=-1&storeId=' + globalStoreId + '&catalogId=' + globalCatalogId + '&categoryId=' + globalCatgroupId2

var globalTopNavLink3 = serverHostname + '/webapp/wcs/stores/servlet/UserRegistrationForm?new=Y&langId=-1&catalogId=' + globalCatalogId +'&storeId=' + globalStoreId

var globalTopNavLink4 = serverHostname + '/anf/index.html'

var globalTopNavLink5 = contactUsLink

var globalTopNavLink7 = serverHostname + '/anf/onlinestore/html/help_home.html'

var globalTopNavLink8 = serverHostname + '/webapp/wcs/stores/servlet/LogonForm?page=register&langId=-1&catalogId=' + globalCatalogId + '&storeId=' + globalStoreId

var globalTopNavLink9 = serverHostname + '/webapp/wcs/stores/servlet/OrderItemDisplay?langId=-1&storeId=' + globalStoreId + '&catalogId=' + globalCatalogId + '&orderId=.'



var globalBotNavLink0 = serverHostname + '/anf/onlinestore/html/gear_tracking.html'

var globalBotNavLink1 = serverHostname + '/webapp/wcs/stores/servlet/InterestItemDisplay?storeId=' + globalStoreId + '&listId=.&langId=-1&catalogId=' + globalCatalogId

var globalBotNavLink2 = serverHostname + '/storelocator/basicSearch.jsp?storeId=' + globalStoreId 

var globalBotNavLink3 = joinEmailLink

var globalBotNavLink4 = serverHostname + '/anf/lifestyles/html/jobs.html';

var globalBotNavLink5 = serverHostname + '/webapp/wcs/stores/servlet/GiftCardDisplay?catalogId=' + globalCatalogId + '&storeId=' + globalStoreId + '&langId=-1';





function getTopNavLink(){

	var args = getTopNavLink.arguments;

	if(typeof(args[0]) == 'string') window.location = args[0];

	else if (typeof(args[0]) == 'function')args[0]()

}



var siteWidth = 859;		



function getTopNavLayers(pageType){

}



function productCartNumber(){

	var cartNum = readCookie('myCart');

	if(cartNum == null){

		if(readCookie('myStore') == '12406'){

			cartNum = '0,Ј0.00';

		} else {

			cartNum = '0,$0.00';

		}

	}

	setCartNum(cartNum);

}



function showNav(img, state){

	for (i=0;i<5;i++){

		rollover(i, 0);

	}

	

	rollover(img, 1);

}



function rollover(img, state){

	oImg = eval("document.img" + img);

	if (state == 1){

		oImg.src = imgOn[img].src;

	}

	else if (state == 0){

		if(oImg){

			oImg.src = imgOff[img].src;

		}

	}

}



function getStyleObject(objectId) {

	if(document.getElementById && document.getElementById(objectId)) {

	return document.getElementById(objectId).style;

	} else if (document.all && document.all(objectId)) {

	return document.all(objectId).style;

	} else if (document.layers && document.layers[objectId]) {

	return document.layers[objectId];

	} else {

	return false;

	}

}



function changeObjectVisibility(objectId, newVisibility) {

	var styleObject = getStyleObject(objectId);

	if(styleObject) {

	styleObject.visibility = newVisibility;

	return true;

	} else {

	return false;

	}

}



function changeObjectProperty(objectId, cssProperty, newValue) {

	var styleObject = getStyleObject(objectId);

	if(styleObject) {

	eval("styleObject."+cssProperty+" = newValue");

	return true;

	} else {

	return false;

	}

}



function getElementsByClassName(node, classname){

    var a = [];

    var re = new RegExp('\\b' + classname + '\\b');

    var els = node.getElementsByTagName("*");

    for(var i=0,j=els.length; i<j; i++)

        if(re.test(els[i].className))a.push(els[i]);

    return a;

}



function hasClass(el, className) {

	var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');

    return re.test(el.className);

}



function addClass(el, className) {

	if (hasClass(el, className)) { return; } // already present

	el.className = [el.className, className].join(' ');

}



function removeClass(el, className){

    var re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', 'g');

	if (!hasClass(el, className)) {

		return; // not present

	}                 

	var c = el.className;

    el.className = c.replace(re, ' ');

    if ( hasClass(el, className) ) { // in case of multiple adjacent

        removeClass(el, className);

    }

}



function hasAncestor(c,o){

	if(!o || !c){ return false; }

	o = $(o);

	var pn = c.parentNode, ret = false, x=0;

	while (pn.tagName.toUpperCase() != 'BODY'){

		if(pn === o){

			ret = true;

			break;

		}else{

			pn = pn.parentNode;

		}

	}

	return ret;

}



/**********COOKIES*****************************/

function createCookie(name,value,days){

	if (days)

	{

		var date = new Date();

		date.setTime(date.getTime()+(days*24*60*60*1000));

		var expires = "; expires="+date.toGMTString();

	}

	else var expires = "";

	var ck = name+"="+value+expires+"; path=/";

	document.cookie = ck;

}



function readCookie(name){

	var nameEQ = 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(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

	}

	return null;

}



var cartLeft = 0;

var cartTop = 0;



function getTopNav(){

	var html = '';

	html += '<script language="JavaScript">';

	html += 'new ypSlideOutMenu("cart", "down", '+cartLeft+', '+cartTop+', 300, 260);';

	html += '</script> ';

	document.write(html);

}

function getTopNavAdd(){

	var html = '';

	html += '<script language="JavaScript">';

	html += 'new ypSlideOutMenu("add", "down", '+cartLeft+', '+cartTop+', 300, 260);';

	html += '</script> ';

	document.write(html);

}

function getTopNavSort(){

	var html = '';

	html += '<script language="JavaScript">';

	html += 'new ypSlideOutMenu("sort", "down", '+cartLeft+', '+cartTop+', 300, 260);';

	html += '</script> ';

	document.write(html);

}

var lang = readCookie('anf-lang');

if (lang == null){

	lang = "en";

}



var division = null;

var category = null;

function highlightMenu(){

	if(document.getElementById('navHolder')){

		if(division == 12202 || division == 12204) var target= 'mens'; 

		else if(division == 12203 || division == 12205) var target = 'womens';

		else return;

		var targetObj = eval('document.getElementById(\'' + target + 'MenuImg\')');

		targetObj.parentNode.onmouseover = null;

		targetObj.parentNode.onmouseout = null;

		targetObj.src = '/anf/images/nav/nav_' + target + '_on.gif';

		

		var link = (division == 12205 || division == 12204) ? document.getElementById('clearance') : category ? document.getElementById(category) : null;

		if(link){	

			link.className = 'menuHighlight'

			var arrow = document.createElement('img');

			arrow.className = 'menuArrow';

			arrow.src = '/anf/onlinestore/common/arrow.gif';

			link.insertBefore(arrow, link.firstChild);

		}

	}else return;

}



function getHeader(cart){

	var headerHtml = '<div id="wrapper">'

	headerHtml += '<div id="headerCtn">';

	headerHtml += '<div id="headerMenu"><a href="/anf/lifestyles/html/homepage.html" onmouseover="rollover(0, 1);" onmouseout="rollover(0, 0);" class="navSpace"><img src="/anf/images/nav/nav_home_off.gif" name="img0" alt="Home" width="45" height="20"/></a><a href="javascript:getTopNavLink(globalTopNavLink1);" onmouseover="rollover(1,1)" onmouseout="rollover(1,0)" class="navSpace"><img src="/anf/images/nav/nav_mens_off.gif" name="img1" alt="Mens" width="44" height="20"/></a><a href="javascript:getTopNavLink(globalTopNavLink2);" onmouseover="rollover(2,1)" onmouseout="rollover(2,0);" class="navSpace"><img name="img2" src="/anf/images/nav/nav_womens_off.gif" alt="Women" id="womensMenuImg" width="62" height="20"/></a><a href="javascript:goToKids();" onmouseover="rollover(3,1);" onmouseout="rollover(3, 0);"><img src="/anf/images/nav/nav_kids_off.gif" name="img3" alt="Kids" width="40" height="20"/></a><img src="/anf/images/nav/nav_maindivider.gif"/><a href="/anf/lifestyles/html/photogallery.html" onmouseover="rollover(4,1)" onmouseout="rollover(4,0);" class="navSpace"><img src="/anf/images/nav/nav_photogallery_off.gif" name="img4" id="nfMenuImg" alt="Photo Gallery" width="98" height="20"/></a><a href="javascript:MM_openBrWindow(\'/anf/lifestyles/html/casting.html\',\'music\', \'toolbar=no,menubar=no,status=no,scrollbars=no,resizable=no,width=900px,height=737px\');" onmouseover="rollover(8,1)" onmouseout="rollover(8,0);" class="navSpace"><img src="/anf/images/nav/nav_casting_off.gif" name="img8" id="castingImg" alt="Casting" width="87" height="20"/></a><a href="javascript:getTopNavLink(globalBotNavLink3)"  onmouseover="rollover(10,1)" onmouseout="rollover(10,0)" class="navSpace"><img src="/anf/images/nav/nav_join_off.gif" name="img10" alt="Join Email" width="75" height="20"/></a><a href="javascript:MM_openBrWindow(\'/anf/lifestyles/flash/af_radio/af_radio.html\',\'music\', \'toolbar=no,menubar=no,status=no,scrollbars=no,resizable=yes,width=350px,height=100px\');" onmouseover="rollover(5,1)" onmouseout="rollover(5,0)" class="navSpace"><img name="img5" src="/anf/images/nav/nav_headphones_off.gif" alt="AF Playlist" width="23" height="20"/></a></div>';

	if(cart == 'nocart'){

		headerHtml += '	<div id="miniCart"><table border="0" cellpadding="0" cellspacing="0"><tr><td style="text-align:center; width:217px;padding-top:3px;"><a href="javascript:getTopNavLink(globalTopNavLink9);" style="width:217px;display:block;color:#ebe9e0;">Shopping Bag&nbsp;&nbsp;<b><span id="cartnum"></span></b>&nbsp;items&nbsp;:&nbsp;<span id="cartTotal"></span></a></td></tr></table></div>';

	}else{

		headerHtml += ' <div id="cartContainer"><div id="cartContent"><table border="0" cellspacing="0" cellpadding="0" width="220"  onmouseover="showCart();" onmouseout="hideCart();"><tr><td class="cartBorder"><table border="0" cellspacing="5" cellpadding="0"><tr><td bgcolor="#FFFFFF"><div id="cartlist" style="z-index:99;"></div></td></tr></table></td></tr></table></div></div>';

		headerHtml += '	<div id="miniCart"><table border="0" cellpadding="0" cellspacing="0"><tr><td onmouseover="miniCart();" onmouseout="hideCart()" style="text-align:center; width:217px; padding-top:3px;"><a href="javascript:getTopNavLink(globalTopNavLink9);" style="width:217px;display:block;color:#ebe9e0;">Shopping Bag&nbsp;&nbsp;<b><span id="cartnum"></span></b>&nbsp;items&nbsp;:&nbsp;<span id="cartTotal"></span></a></td></tr></table></div>';

	}

	headerHtml += '	<div id="topNavAcctOptions">';

	if(readCookie('afstatus') == '1'){headerHtml += '<a href="javascript:getTopNavLink(globalTopNavLink8)" onmouseover="rollover(12,1)" onmouseout="rollover(12,0)"><img name="img12" style="margin-top:2px;" src="/anf/images/nav/nav_account_off.gif" alt="Your Account" width="105" height="10"/></a><br/><a href="javascript:getTopNavLink(globalBotNavLink1)" onmouseover="rollover(7,1)" onmouseout="rollover(7,0)"><img name="img7" src="/anf/images/nav/nav_wishlist_off.gif"  alt="My Wish List" width="105" height="10"/></a></div>';}else{headerHtml += '<a href="javascript:getTopNavLink(globalTopNavLink8)" onmouseover="rollover(6,1)" onmouseout="rollover(6,0)"><img name="img6" src="/anf/images/nav/nav_signin_off.gif" alt="Sign in" width="49" height="20"/></a><img src="/anf/images/nav/nav_divider.gif"/><a href="javascript:getTopNavLink(globalTopNavLink3)" onmouseover="rollover(11,1)" onmouseout="rollover(11,0)"><img src="/anf/images/nav/nav_register_off.gif" alt="Register" name="img11" width="53" height="20"/></a></div>';}

	headerHtml += '<script type="text/javascript">productCartNumber();</script>';

	headerHtml += '</div>';

	headerHtml += '<div id="menuLine">&nbsp;</div>';

	

	document.write(headerHtml);

}



function getFooter(){

	var footerHtml = '<div id="footer"><div id="divCtn">';

	footerHtml += '<span id="creditCardLink"><a href="https://onlineaccess.mycreditcard.cc/abercrombie" target="window2" class="footerSpace"><img src="/anf/images/nav/footer_creditcard.gif" width="59" height="16"/><\/a></span>';

	footerHtml += '<a href="javascript:getTopNavLink(globalBotNavLink0)"  class="footerSpace"><img src="/anf/images/nav/footer_ordertracking.gif" width="79" height="16"/><\/a><a class="footerSpace" href="javascript:MM_openBrWindow(\'/anf/lifestyles/html/investorrelations.html\',\'investor\',\'toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=750,height=600\');"><img src="/anf/images/nav/footer_investors.gif" width="49" height="16"><\/a><a href="javascript:getTopNavLink(globalTopNavLink5)" class="footerSpace"><img src="/anf/images/nav/footer_contact.gif" width="42" height="16"/><\/a>';

	footerHtml += '<a href="javascript:MM_openBrWindow(\'/anf/hr/jobs/careers.html\',\'jobs\',\'toolbar=no,menubar=no,status=yes,scrollbars=no,resizable=yes,width=700px,height=560px\');" class="footerSpace"><img src="/anf/images/nav/footer_careers.gif" width="42" height="16"/><\/a><a href="javascript:MM_openBrWindow(\'/anf/hr/jobs/diversity.html\',\'jobs\',\'toolbar=no,menubar=no,status=yes,scrollbars=no,resizable=yes,width=700px,height=560px\');" class="footerSpace"><img src="/anf/images/nav/footer_diversity.gif" width="46" height="16"/><\/a><a href="/anf/lifestyles/html/brandprotection.html" class="footerSpace"><img src="/anf/images/nav/footer_brandprotection.gif" width="89" height="16"/><\/a>';



	if(readCookie('myStore') == '11306'){

		footerHtml += '<a href="javascript:MM_openBrWindow(\'/anf/privacy_policy_ca.html\',\'privacy\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_privacy.gif" width="38" height="16"/><\/a><a href="javascript:MM_openBrWindow(\'/anf/site_use_ca.html\',\'siteuse\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_siteuse.gif" width="40" height="16"/><\/a>';

	}else if(readCookie('myStore') == '12406') {

		footerHtml += '<a href="javascript:MM_openBrWindow(\'/anf/privacy_policy_uk.html\',\'privacy\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_privacy.gif" width="38" height="16"/><\/a><a href="javascript:MM_openBrWindow(\'/anf/site_use_uk.html\',\'siteuse\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_siteuse.gif" width="40" height="16"/><\/a>';

	}else{

		footerHtml += '<a href="javascript:MM_openBrWindow(\'/anf/privacy_policy.html\',\'privacy\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_privacy.gif" width="38" height="16"/><\/a>';

		footerHtml += '<a href="javascript:MM_openBrWindow(\'/anf/privacy_policy_cali.html\',\'privacy\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_caprivacy.gif" width="56" height="16"/><\/a><a href="javascript:MM_openBrWindow(\'/anf/site_use.html\',\'siteuse\',\'scrollbars=yes,width=460,height=460\');" class="footerSpace"><img src="/anf/images/nav/footer_siteuse.gif" width="40" height="16"/><\/a>';

	}

	footerHtml += '<a href="javascript:getTopNavLink(globalBotNavLink2);" class="footerSpace"><img src="/anf/images/nav/footer_locator.gif" width="74" height="16"/></a>';

	

	if(readCookie('anf-lang') != 'ja'){

		if(readCookie('myStore') == '11306'){

			footerHtml += '<a href="/anf/onlinestore/html/help_home_ca.html" class="footerSpace"><img src="/anf/images/nav/footer_help.gif" width="30" height="16"/></a>';

		}else if(readCookie('myStore') == '12406') {

			footerHtml += '<a href="/anf/onlinestore/html/help_home_uk.html" class="footerSpace"><img src="/anf/images/nav/footer_help.gif" width="30" height="16"/></a>';

		} else{

			footerHtml += '<a href="javascript:getTopNavLink(globalTopNavLink7)" class="footerSpace"><img src="/anf/images/nav/footer_help.gif" width="30" height="16"/></a>';

		}

	}else{

		footerHtml += '<a href="/anf/onlinestore/html/help_home_jp.html" class="footerSpace"><img src="/anf/images/nav/footer_help_jp.gif" width="30" height="16"/></a>';			

	}

	

	footerHtml += '</div></div></div><br/>';



	document.write(footerHtml);

	

	if(readCookie('myStore') == '11306' || readCookie('myStore') == '12406'){

		changeObjectProperty('creditCardLink','display','none');

	}

}



function setCartNum(thenum){

	var parts = thenum.split(",");

	var q = parts[0];

	var amount = parts[1];

	if (parts[2]){

		amount = amount +','+ parts[2]

	}

	

	//if (document.getElementById('cartContainer')){

		//newHeight = (q*33+190);

		//document.getElementById('cartContainer').style.height = newHeight+"px";

		//document.getElementById('cartContainer').style.clip = "rect(0px, 300px, " + newHeight + "px, 0px)";

		//document.getElementById('cartContent').style.height = newHeight+"px";

		//document.getElementById('cartContent').style.clip = "rect(0px, 300px, " + newHeight + "px, 0px)";

		

	//}

	

	setContent('cartnum',q);

	setContent('cartTotal',amount);

}



function hideFooterElements(){

	if(readCookie('myStore') == '11306' || readCookie('myStore') == '12406'){

		changeObjectProperty('creditCardLink','display','none');

	}

}



var abtest = "B";



ypSlideOutMenu.Registry = []

ypSlideOutMenu.aniLen = 200

ypSlideOutMenu.hideDelay = 125

ypSlideOutMenu.minCPUResolution = 10



function ypSlideOutMenu(id, dir, left, top, width, height){

	this.ie  = document.all ? 1 : 0

	this.ns4 = document.layers ? 1 : 0

	this.dom = document.getElementById ? 1 : 0



	if (this.ie || this.ns4 || this.dom) {

		this.id			 = id

		this.dir		 = dir

		this.orientation = dir == "left" || dir == "right" ? "h" : "v"

		this.dirType	 = dir == "right" || dir == "down" ? "-" : "+"

		this.dim		 = this.orientation == "h" ? width : height

		this.hideTimer	 = false

		this.aniTimer	 = false

		this.open		 = false

		this.over		 = false

		this.startTime	 = 0



		this.gRef = "ypSlideOutMenu_"+id

		eval(this.gRef+"=this")



		ypSlideOutMenu.Registry[id] = this



		if (document.all){

			mWidth = document.body.clientWidth;

		} else if (document.layers){

			mWidth = window.innerWidth;

		} else if (document.getElementById){

			mWidth = window.innerWidth;

		}

		currentLeft = left;

		newLeft = parseInt(siteWidth/2) - currentLeft;

		newLeft = parseInt(mWidth/2) - newLeft;



		if (mWidth >= siteWidth){

				left = newLeft;

		} else{}



		newleft = left + "px";



		var d = document

		d.write('<style type="text/css">')

		d.write('#' + this.id + 'Container { visibility:hidden; ')

		d.write('z-index:65; ')

		//d.write('left:' + newleft +'; ')

		//d.write('top:' + top + 'px; ')

		d.write('overflow:hidden; }')

		d.write('#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ')

		d.write('width:250px; ')

		d.write('height:' + height + 'px; ')

		//d.write('clip:rect(0px, ' + width + 'px, ' + height + 'px, 0px); ')

		d.write('}')

		d.write('</style>')



		this.load()

	}

}



function resetMenus(){

	resetCart();

}



function resetCart(){

	if (document.getElementById('cartContainer')){

		newLeft2 = document.getElementById('miniCart').offsetLeft;

		//document.getElementById('cartContainer').style.left = newLeft2+"px";

	}

}



ypSlideOutMenu.prototype.load = function() {

	var d = document

	var lyrId1 = this.id + "Container"

	var lyrId2 = this.id + "Content"

	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]

	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)

	var temp



	if (!obj1 || !obj2) {

		window.setTimeout(this.gRef + ".load()", 100)

	}

	else {

		this.container	= obj1

		this.menu		= obj2

		this.style		= this.ns4 ? this.menu : this.menu.style

		this.homePos	= eval("0" + this.dirType + this.dim)

		this.outPos		= 0

		this.accelConst	= (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen



		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);



		this.endSlide()

	}

}



ypSlideOutMenu.showMenu = function(id){

	//alert(id);

	var reg = ypSlideOutMenu.Registry

	var obj = ypSlideOutMenu.Registry[id]

	//alert(obj);

	if (obj.container) {

		obj.over = true



		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }

		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)

	}

}



ypSlideOutMenu.hideMenu = function(id){

	var obj = ypSlideOutMenu.Registry[id]

		if (obj.container) {

			if (obj.hideTimer) window.clearTimeout(obj.hideTimer)

			obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);

		}

}



ypSlideOutMenu.hide = function(id){

	var obj = ypSlideOutMenu.Registry[id]

	obj.over = false



	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)



	obj.hideTimer = 0



	if (obj.open && !obj.aniTimer) obj.startSlide(false)

}



ypSlideOutMenu.prototype.startSlide = function(open) {

	

	this[open ? "onactivate" : "ondeactivate"]()

	this.open = open

	if (open) this.setVisibility(true)

	this.startTime = (new Date()).getTime()

	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)

}



ypSlideOutMenu.prototype.slide = function() {

	var elapsed = (new Date()).getTime() - this.startTime

	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()

	else {

		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)

		if (this.open && this.dirType == "-")		d = -d

		else if (this.open && this.dirType == "+")	d = -d

		else if (!this.open && this.dirType == "-")	d = -this.dim + d

		else										d = this.dim + d



		this.moveTo(d)

	}

}



ypSlideOutMenu.prototype.endSlide = function() {

	this.aniTimer = window.clearTimeout(this.aniTimer)

	this.moveTo(this.open ? this.outPos : this.homePos)

	if (!this.open) this.setVisibility(false)

	if ((this.open && !this.over) || (!this.open && this.over)) {

		this.startSlide(this.over)

	}

	if ((!this.open) && (this.id == 'cart')){

		changeObjectProperty('cartCrumbs', 'backgroundColor', 'transparent');

		rollover(9, 0);

		var ua = navigator.userAgent.toLowerCase();

		if ((ua.indexOf("msie") != -1) && (parseFloat(navigator.appVersion.split("MSIE")[1]) < 7) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)){

			changeObjectProperty('size','visibility','visible');

			changeObjectProperty('sizelist','visibility','visible');

		}

	}

}



ypSlideOutMenu.prototype.setVisibility = function(bShow) {

	var s = this.ns4 ? this.container : this.container.style

	s.visibility = bShow ? "visible" : "hidden"

}

ypSlideOutMenu.prototype.moveTo = function(p) {

	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : (p) + "px"

}

ypSlideOutMenu.prototype.getPos = function(c) {

	return parseInt(this.style[c])

}





ypSlideOutMenu.prototype.onactivate	= function() { }

ypSlideOutMenu.prototype.ondeactivate	= function() { }



function showWrap(){

	changeObjectProperty('wrapper','visibility','visible');

	changeObjectProperty('contentcontainer','display','block');

	changeObjectProperty('gencntnr','visibility','visible');

	resetCart();

}





var xmlDoc = null;

var addItem = false;

function miniCart(){

	

	//if (xmlDoc == null){

		

		//makeRequest('/webapp/wcs/stores/servlet/MiniOrderItemDisplay');

	//} else {

		makeCart();

	//}

}



function makeRequest(url, type) {

    var http_request = false;

	var getstr = "?";

	getstr += "storeId="+globalStoreId+"&";

	getstr += "langId="+-1+"&";

	getstr += "catalogId="+globalCatalogId+"&";

	getstr += "orderId=.";



    if (window.XMLHttpRequest) {

        http_request = new XMLHttpRequest();

        if (http_request.overrideMimeType) {

            http_request.overrideMimeType('text/xml');

        }

    } else if (window.ActiveXObject) {

        try {

            http_request = new ActiveXObject("Msxml2.XMLHTTP");

        } catch (e) {

            try {

                http_request = new ActiveXObject("Microsoft.XMLHTTP");

            } catch (e) {}

        }

    }



    if (!http_request) {

        return false;

    }

    getstr = url + getstr;

    http_request.onreadystatechange = function() { getContents(http_request, type); };

    http_request.open('Get', getstr, true);

    http_request.send(null);

}



function getContents(http_request, type) {

    if (http_request.readyState == 4) {

        if (http_request.status == 200) {

        	xmlDoc = http_request.responseXML;

        	makeCart(type);

        } else {

        }

    } else {

    }

}



function makeCart(type){

			showCart("cart");

}

function makeAdd(type){

			showCart("add");

			setTimeout("hideAdd()", 5000);

}



function hideAdd(){

		ypSlideOutMenu.hideMenu('add');

		addItem = false;

}

function hideCart(){

	addItem = false;

	ypSlideOutMenu.hideMenu('cart');

}



function showCart(id){

	ypSlideOutMenu.showMenu(id);

	changeObjectProperty('cartCrumbs', 'backgroundColor', '#B1B1B1');

	var ua = navigator.userAgent.toLowerCase();

	if ((ua.indexOf("msie") != -1) && (parseFloat(navigator.appVersion.split("MSIE")[1]) < 7) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1)){

		changeObjectProperty('size','visibility','hidden');

		changeObjectProperty('sizelist','visibility','hidden');

	}

}



function setContent(id,content){

	if (document.all){

		document.all[id].innerHTML = content;

	} else if (document.layers){

		document.layers[id].innerHTML = content;

	} else if (document.getElementById){

		document.getElementById(id).innerHTML = content;

	}

}



function limitChars(fe, num){

		fe.value = fe.value.slice(0, num);

}



function selectOption(s,m){

	if(!s){ return; }

	for (var i=0; i<s.length; i++){

		if (s.options[i].value == m){

			s.options[i].selected = true;

			break;

		}

	}

}



function IsEmailValid(eml){    

    var test = eml;

    var lAt = test.indexOf("@")

    var lDot = test.lastIndexOf(".")

    //Checks over 5: x@x.x

    if ( test.length <5 || lAt <= 0 || lAt >= lDot - 1 || lDot >= test.length) {                

        return false;

    }else{

    	if(filter(test)){

    		return true;

        }else{

        	return false;

        }

    }

}

function filter(address){		

	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	return filter.test(address);

}



function ajaxCall(url, params, cb, m, rt, as) {

	this.url = url

	this.parameters = params

	this.callback = cb

	this.method = m ? m : 'get'

	this.responseType = rt ? rt : 'text/xml'

	this.async = as ? as : true

	this.response = null

}



ajaxCall.prototype.parseForm = function(form){

	var formObj = null;

	if(typeof(form) == 'string'){

		if(document.forms[form]) formObj = document.forms[form]

		else if(document.getElementById(form)) formObj = document.getElementById(form)

	}else if (typeof(form) == 'object') formObj = form



	if(!formObj) return

}



ajaxCall.prototype.makeRequest = function(){

	var urlString = this.url;

	if(this.parameters){

		urlString += '?'

		for(p in this.parameters) urlString += p + '=' + this.parameters[p] + '&';

	}

	if (window.XMLHttpRequest) { 

		http_request = new XMLHttpRequest();

		if (http_request.overrideMimeType) 

			http_request.overrideMimeType(this.responseType);

	} else if (window.ActiveXObject) { // IE

		try {

			http_request = new ActiveXObject("Msxml2.XMLHTTP");

		} catch (e) {

			try {

				http_request = new ActiveXObject("Microsoft.XMLHTTP");

			} catch (e) {}

		}

	}

	if (!http_request) return false;

	var ajaxObj = this;

	http_request.onreadystatechange = function() {ajaxObj.getContents(http_request)};

	http_request.open(this.method, urlString, this.async);

	http_request.send('');

}



ajaxCall.prototype.getContents = function(http_request){

	if (http_request.readyState == 4) {

		if (http_request.status == 200) {

        	this.response = http_request.responseText;

        	this.callback(http_request)       	

        } else {

        }

    } else {

    }

}





function addEvent(elm, evType, fn, useCapture){

//x-browser event handling function written by Scott Andrew

	if(elm.addEventListener){

		elm.addEventListener(evType, fn, useCapture);

		return true;

	}else if(elm.attachEvent){

			var r = elm.attachEvent('on' + evType, fn);

			//EventCache.add(elm, evType, fn);

			return r;

	}else{

			elm['on' + evType] = fn;

	}

}



function $() {

	var elements = new Array();

	for (var i = 0; i < arguments.length; i++) {

		var element = arguments[i];

		if (typeof element == 'string')

			element = document.getElementById(element);

		if (arguments.length == 1)

			return element;

		elements.push(element);

	}

	return elements;

}



function getIEVersion()

{

  var rv = -1; // Return value assumes failure

  if (navigator.appName == 'Microsoft Internet Explorer')

  {

    var ua = navigator.userAgent;

    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");

    if (re.exec(ua) != null)

      rv = parseFloat( RegExp.$1 );

  }

  return rv;

}



var contactUsType = null

function contactUsLink(p){

	if(p) contactUsType = p

	var params = {

			"storeId" : globalStoreId,

			"catalogId" : globalCatalogId,

			"langId" : -1,

			"type" : p ? p : 'def'

	}

	var cu = new ajaxCall('/anf/lifestyles/html/contactus.html', params, contactUsCB, null, 'text/plain', null);

	cu.makeRequest();

}



function contactUsCB(http_request){

	getFadeUpDiv('cu', http_request.responseText);

	contactForm.init(contactUsType);

}



function contactUsSubmit(){

	if(!IsEmailValid(document.forms.ContactUsForm.fromEmail.value)){

		document.getElementById('cuError').style.color = '#681414';

		document.getElementById('cuError').innerHTML = 'Please enter a valid e-mail address';

	}else if(document.forms.ContactUsForm.bodyEmail.value.length > 250){

		document.getElementById('cuError').style.color = '#681414';

		document.getElementById('cuError').innerHTML = 'Please limit comments to 250 characters';

	}else{

		document.getElementById('cuError').innerHTML = '&nbsp;'

		document.getElementById('cuError').visibility = 'hidden'

		params = {

			'storeId' : globalStoreId,

			'subjectEmail' : document.forms.ContactUsForm.subjectEmail.value.replace(/&/g, '%26'),

			'subSubjectEmail' : document.forms.ContactUsForm.subSubjectEmail.value.replace(/&/g, '%26'),

			'ordNum' : document.forms.ContactUsForm.ordNum.value,

			'GCNum' : document.forms.ContactUsForm.GCNum.value,

			'fromName' : document.forms.ContactUsForm.fromName.value,

			'fromEmail' : document.forms.ContactUsForm.fromEmail.value,

			'bodyEmail' : encodeURIComponent(document.forms.ContactUsForm.bodyEmail.value)

		}

		var cuSub = new ajaxCall('/webapp/wcs/stores/servlet/ContactUsForm', params, cuSubCB, 'post', null, null);

		cmCreatePageviewTag("CONTACT US FADE UP","13000");

		cuSub.makeRequest();

	}

}



function cuSubCB(http_request){

	document.forms.ContactUsForm.style.visibility = 'hidden';

	document.getElementById('response').innerHTML = 'Thanks! We got it!';

}



contactForm = {

	questionType: '',

	init: function(type){

		contactForm.questionType = type;

		contactForm.initCategoryArray();

		contactForm.populate();

		var catSelect = document.forms.ContactUsForm.subjectEmail;

		var subSelect = document.forms.ContactUsForm.subSubjectEmail;

		addEvent(catSelect, 'change', contactForm.getSelected);

		addEvent(subSelect, 'change', contactForm.populateFields);

	},

	categoryArray:[],

	category: function(text, value, subcats){

		this.optText = text;

		this.optValue = value;

		this.optSubCats = contactForm.getSubCats(subcats);

	},

	subCategory: function (text, value){

		this.optText = text;

		this.optValue = value;

	},

	initCategoryArray: function(){

		contactForm.categoryArray[0] = new contactForm.category('Select One','Select One','');

		contactForm.categoryArray[1] = new contactForm.category('General Questions','General','general');

		contactForm.categoryArray[2] = new contactForm.category('A&F Stores','A&F Stores','stores');

		contactForm.categoryArray[3] = new contactForm.category('Online Orders','abercrombie.com','site');

		contactForm.categoryArray[4] = new contactForm.category('A&F Merchandise','A&F Merchandise','merchandise');

		contactForm.categoryArray[5] = new contactForm.category('Technical','Technical','');

	},

	getSubCats: function(category){

		var subCats = new Array();

		if(category == 'general'){

			subCats[0] = new contactForm.subCategory('A&F Credit Card','A&F Credit Card');			

			subCats[1] = new contactForm.subCategory('Your Store Experience','Store Experience');

			subCats[2] = new contactForm.subCategory('Your Online Experience','Online Experience');

			subCats[3] = new contactForm.subCategory('Modeling','Modeling');

			subCats[4] = new contactForm.subCategory('Investor Relations','Investor Relations');

			subCats[5] = new contactForm.subCategory('Careers','Careers');

			subCats[6] = new contactForm.subCategory('General','General');

		} else if(category == 'stores'){

			subCats[0] = new contactForm.subCategory('Locations/New Stores','Locations/New Stores');

			subCats[1] = new contactForm.subCategory('Your Store Experience','Store Experience');

			subCats[2] = new contactForm.subCategory('Careers','Careers');

			subCats[3] = new contactForm.subCategory('A&F Gift Card','A&F Gift Card');

			subCats[4] = new contactForm.subCategory('Billing Inquiry','Billing Inquiry');

			subCats[5] = new contactForm.subCategory('Returns/Exchanges','Returns/Exchanges');

		} else if(category == 'site'){

			subCats[0] = new contactForm.subCategory('Order Status','Order Status');

			subCats[1] = new contactForm.subCategory('Returns/Exchanges','Returns/Exchanges');

			subCats[2] = new contactForm.subCategory('Billing Inquiry','Billing Inquiry');

			subCats[3] = new contactForm.subCategory('Backorder','Backorder');

			subCats[4] = new contactForm.subCategory('A&F Gift Card','A&F Gift Card');

			subCats[5] = new contactForm.subCategory('Your Online Experience','Your Online Experience');

		} else if (category == 'merchandise') {

			subCats[0] = new contactForm.subCategory('Product Questions','Product Questions');

			subCats[1] = new contactForm.subCategory('Sizing','Sizing');

			subCats[2] = new contactForm.subCategory('A&F Quality','A&F Quality');

		}

		return subCats;

	},

	populate: function(){

		document.forms.ContactUsForm.storeId.value = globalStoreId;

		for (i=0; i < contactForm.categoryArray.length; i++) {

			document.forms.ContactUsForm.subjectEmail[i] = new Option(contactForm.categoryArray[i].optText, contactForm.categoryArray[i].optText);

		}//close cat loop

		if(contactForm.questionType == 'technical'){

			document.forms.ContactUsForm.subjectEmail.selectedIndex = 5;

		}else if (contactForm.questionType == 'product'){

			document.forms.ContactUsForm.subjectEmail.selectedIndex = 4;

		}else if (contactForm.questionType == 'general'){

			document.forms.ContactUsForm.subjectEmail.selectedIndex = 1;

		}else{

			document.forms.ContactUsForm.subjectEmail.selectedIndex = 0;

		}

		contactForm.populateSub(document.forms.ContactUsForm.subjectEmail.selectedIndex);

	},

	populateSub: function(selected){

		document.forms.ContactUsForm.subSubjectEmail.length = 0;

		if (contactForm.categoryArray[selected].optSubCats.length > 0){

			for(i = 0; i < contactForm.categoryArray[selected].optSubCats.length; i++){

				document.forms.ContactUsForm.subSubjectEmail.options[i] = new Option(contactForm.categoryArray[selected].optSubCats[i].optText, contactForm.categoryArray[selected].optSubCats[i].optValue);

			}

			document.getElementById('subCatSpan').style.display = 'inline';

			document.getElementById('fadeUpHolder').style.height = '450px';

			} else {

			document.getElementById('subCatSpan').style.display = 'none';

		}

		contactForm.populateFields()

	},

	getSelected: function(e){

		var select = window.event ? window.event.srcElement : e ? e.target : null;

		if(!select)return;

		if(document.forms.ContactUsForm.subjectEmail.selectedIndex == 3){

			document.getElementById('ordNumSpan').style.display = 'inline';

			document.getElementById('fadeUpHolder').style.height = '460px';

		}else{

			document.getElementById('ordNumSpan').style.display = 'none';

		}

		contactForm.populateSub(select.selectedIndex);

	},

	

	populateFields: function(){

		if(((document.forms.ContactUsForm.subjectEmail.selectedIndex == 3 && document.forms.ContactUsForm.subSubjectEmail.selectedIndex == 4) || (document.forms.ContactUsForm.subjectEmail.selectedIndex == 2 && document.forms.ContactUsForm.subSubjectEmail.selectedIndex == 3))){

			document.getElementById('GCNumSpan').style.display = 'inline';

			document.getElementById('fadeUpHolder').style.height = '495px';

		}else{

			document.getElementById('GCNumSpan').style.display = 'none';

		}

	}

}



function joinEmailLink(){

	var params = {

			"storeId" : globalStoreId,

			"catalogId" : globalCatalogId,

			"langId" : -1

	}

	var ml = new ajaxCall('/anf/lifestyles/html/mailingList.html', params, joinEmailCB, null, 'text/plain', null);

	ml.makeRequest()

}



function joinEmailCB(httpRequest){

	getFadeUpDiv('je', http_request.responseText);

	if(nvp_get('email') != 'noval') document.forms.MailingList.email.value = nvp_get('email')

}



function goToKids(){

	var html = '<div id="fadeCtn"><div id="fadeUpBorder">'

	html +=	'		<div id="fadeUpDiv" style="margin:0; padding:0;">'

	html +=	'			<a href="javascript:closeFadeUp();" id="fadeClose"><img src="/anf/lifestyles/art/close_popup.gif" /></a>'

	html += '			<img src="/anf/lifestyles/art/kidsprompt.gif" id="kidsPromptImg" usemap="#gtkMap" />'

	html += '			<map name="gtkMap"><area shape="rect" coords="46,155,224,176" href="javascript:closeFadeUp(); MM_openBrWindow(\'http://www.abercrombiekids.com/kids/index.html?cm_ven=redirect&cm_cat=topnav&cm_pla=kids&cm_ite=kids_site\',\'\',\'\')"/></map>'

	html += '		</div>'

	html += '	</div></div>'

	getFadeUpDiv('gtk', html);

}





function validateMlInput(page){

	var cbFn = mlSubmitCB

	var responseDiv = 'response'

	var f = document.forms.MailingList

	if(page == 'home'){

		cbFn = mlHomeSubmitCB

		responseDiv = 'responseHome'

		f = document.forms.MailingListHome 

	}

	var emailValue = f.email.value

	if (!IsEmailValid(emailValue)){

		document.getElementById(responseDiv).innerHTML = "<b>Please enter a valid e-mail address</b>";

		if (page == 'fadeUp') document.getElementById(responseDiv).style.color = '#681414';

	}else {

		var params = {

			'aid' : f.aid.value,

			'sub' : f.sub.value,

			'unsub' : f.unsub.value,

			'resub' : f.resub.value,

			'a' : f.a.value,

			'storeId' : f.storeId.value,

			'catalogId' : f.catalogId.value,

			'languageId' : f.languageId.value,

			'URL' : f.URL.value,

			'email' : f.email.value

		}

		var mlSubmit = new ajaxCall('/webapp/wcs/stores/servlet/MailSubscription', params, cbFn, 'post', null, null);

		mlSubmit.makeRequest();

	}

}



function mlHomeSubmitCB(http_request){

	var xml = http_request.responseXML;

	var status = xml.getElementsByTagName('mail_status')[0].firstChild.nodeValue;

	var msg = xml.getElementsByTagName('response')[0].firstChild.nodeValue;

	document.getElementById('responseHome').innerHTML = msg;

	document.forms.MailingListHome.email.value = '';

}



function mlSubmitCB(http_request){

	var xml = http_request.responseXML;

	var status = xml.getElementsByTagName('mail_status')[0].firstChild.nodeValue;

	var msg = xml.getElementsByTagName('response')[0].firstChild.nodeValue;

	document.getElementById('response').style.color = '#681414';

	document.getElementById('response').innerHTML = msg;

	document.getElementById('fadeUpHolder').style.height = '199px';

	document.forms.MailingList.email.value = '';

}



var rmvdOs = new Array();

function getFadeUpDiv(l, content){

	if(!content) return;

	var fadeUpHolder = document.createElement('div')

	fadeUpHolder.id = 'fadeUpHolder'

	fadeUpHolder.style.display = 'none'

	fadeUpHolder.style.width = '279px';

	if(getIEVersion() > -1){

		fadeUpHolder.style.height = l == 'cu' ? '379px' : l == 'je' ? '174px' : l == 'eaf' ? '278px' : '209px' ;

	}

	fadeUpHolder.innerHTML = content

	document.getElementsByTagName('body')[0].appendChild(fadeUpHolder)

	var editMode = document.getElementById('editMode') ? document.getElementById('editMode') : null

	if(!editMode){

		var editMode = document.createElement('div')

		editMode.id = 'editMode'

		editMode.style.display = 'none'

		document.getElementsByTagName('body')[0].appendChild(editMode);

	}

	var isMac = navigator.userAgent.toLowerCase().indexOf('mac') > -1 ? true : false

	var objectEmbed = (document.getElementsByTagName('object').length > 0 || document.getElementsByTagName('embed').length > 0) ? true : false

	if(isMac && objectEmbed){

		var oes = document.getElementsByTagName('object').length == 0 && document.getElementsByTagName('embed').length > 0 ? document.getElementsByTagName('embed') : document.getElementsByTagName('object');

		for(i = 0; i < oes.length; i++){

			rmvdOs[i] = {'parent' : oes[i].parentNode, 'child' : oes[i]} 

			oes[i].parentNode.removeChild(oes[i])

		}

	}

	fadeThisDiv('fadeUpHolder');

}



function closeFadeUp(){

	fadeThisDiv('fadeUpHolder')

	changeObjectVisibility('size','visible')

	changeObjectVisibility('sizelist','visible')

	setTimeout("document.getElementsByTagName('body')[0].removeChild(document.getElementById('fadeUpHolder'))", 500)

	if(rmvdOs.length > 0){

		for(i = 0; i < rmvdOs.length; i++)rmvdOs[i].parent.appendChild(rmvdOs[i].child);

	}

}



var myEffects = {

  fade: function(elid) {

	var opacs = ["0",".1",".2",".3",".4",".5",".6",".7",".8",".9","1"];

	var opacs2 = ["0",".1",".2",".3",".4",".5",".6"];

	if (document.getElementById(elid).style.display == 'none'){

		if(elid == 'editMode'){

			document.getElementById(elid).style.opacity = '0';

			document.getElementById(elid).style.filter = 'alpha(opacity=0)';

			document.getElementById(elid).style.display = 'block';

			for (var i = 0; i < 7; i++){

				setTimeout('document.getElementById(\''+elid+'\').style.opacity = "'+opacs2[i]+'";', i * 40);

				setTimeout('document.getElementById(\''+elid+'\').style.filter = "alpha(opacity='+(opacs2[i] * 100)+')";', i * 40);

			}

		} else {

			document.getElementById(elid).style.opacity = '0';

			document.getElementById(elid).style.filter = 'alpha(opacity=0)';

			document.getElementById(elid).style.display = 'block';

			for (var i = 0; i < 11; i++){

				setTimeout('document.getElementById(\''+elid+'\').style.opacity = "'+opacs[i]+'";', i * 40);

				setTimeout('document.getElementById(\''+elid+'\').style.filter = "alpha(opacity='+(opacs[i] * 100)+')";', i * 40);

			}

		}

	}else{

		if(elid == 'editMode'){

			opacs2.reverse();

			for (var i = 0; i < 7; i++) {

		    	setTimeout('document.getElementById(\''+elid+'\').style.opacity = "'+opacs2[i]+'";', i * 40);

		    	setTimeout('document.getElementById(\''+elid+'\').style.filter = "alpha(opacity='+(opacs2[i] * 100)+')";', i * 40);

			}

			setTimeout('document.getElementById(\''+elid+'\').style.display = "none";', i * 40);

		} else{

			opacs.reverse();

			for (var i = 0; i < 11; i++) {

		    	setTimeout('document.getElementById(\''+elid+'\').style.opacity = "'+opacs[i]+'";', i * 40);

		    	setTimeout('document.getElementById(\''+elid+'\').style.filter = "alpha(opacity='+(opacs[i] * 100)+')";', i * 40);

			}

			setTimeout('document.getElementById(\''+elid+'\').style.display = "none";', i * 40);

		}

	}

   }

}



function fadeThisDiv(divname){

	var floatThisDiv = false;

	if (document.getElementById(divname).style.display == 'none'){

		var height1 = document.body.offsetHeight;

		var height2 = document.documentElement.clientHeight;

		if(height1 > height2){

			var nHeight = height1+"px";;

		}else{

			var nHeight = height2+"px";;

		}

		

		var ctnTop = 175;

		var nLeft = document.getElementById('wrapper').offsetLeft+"px";

		var nLeft2 = (document.getElementById('headerCtn').offsetLeft + 250)+"px";

		var nWidth = document.getElementById('wrapper').offsetWidth+"px";

		var nTop = ctnTop + "px";

		var divObj = document.getElementById(divname);

		var wrapObj = document.getElementById('wrapper');

		var wrapObj2 = document.getElementById('wrapper2');

				

		changeObjectProperty('editMode', 'left', nLeft);

		changeObjectProperty('editMode', 'height', nHeight);

		changeObjectProperty('editMode', 'width', nWidth);

		changeObjectProperty(divname, 'left', nLeft2);

		changeObjectProperty(divname, 'top', nTop);

		

		if (divObj.childNodes[0].id != 'cover') {

			var ieMat=document.createElement('iframe');

			ieMat.src="/anf/onlinestore/html/blank.html";

			ieMat.scrolling="no";

			ieMat.frameBorder="0";

			ieMat.id="cover";

			ieMat.style.background = 'none';

			ieMat.style.width=getStyleObject(divname).width;

			ieMat.style.height=getStyleObject(divname).height;

			ieMat.style.zIndex="-1";

			divObj.insertBefore(ieMat, divObj.childNodes[0]);

		}

		floatThisDiv = true;

		cmCreatePageviewTag("FADE UP: "+divname,"13000");

	}

	myEffects.fade('editMode');

	myEffects.fade(divname);

	if (floatThisDiv){

		JSFX_FloatTopDiv(divname);

	}

}



function getCookieVal(offset) {

     var endstr = document.cookie.indexOf (";", offset);

     if (endstr == -1)

         endstr = document.cookie.length;

     return unescape(document.cookie.substring(offset, endstr));

}



function GetCookie(name) {

   var arg = name + "=";

   var alen = arg.length;

   var clen = document.cookie.length;

   var i = 0;

   while (i < clen) {

     var j = i + alen;

     if (document.cookie.substring(i, j) == arg)

       return getCookieVal (j);

     i = document.cookie.indexOf(" ", i) + 1;

     if (i == 0) break;

   }

   return null;

}



function DeleteCookie(name,path,domain) {

   if (GetCookie(name)) {

  	 document.cookie = name + '=' +

       ((path) ? '; path=' + path : '') +

       ((domain) ? '; domain=' + domain : '') +

       '; expires=Thu, 01-Jan-70 00:00:01 GMT';

   }

}



function acctLogoff(){

	DeleteCookie('afstatus','/', + serverHostname);

	window.location = '/webapp/wcs/stores/servlet/Logoff?storeId=' + globalStoreId + '&langId=-1&URL=/anf/lifestyles/html/homepage.html';

}



var verticalpos="fromtop"



function JSFX_FloatTopDiv(thediv)

{

	var startX = document.getElementById('wrapper').offsetLeft + 125;

	startY = 130;

	var ns = (navigator.appName.indexOf("Netscape") != -1);

	var d = document;

	function ml(id)

	{

		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];

		if(d.layers)el.style=el;

		el.sP=function(x,y){

			this.style.top=y + "px";;

		};

		el.x = document.getElementById('wrapper').offsetLeft + 125;

		if (verticalpos=="fromtop")

		el.y = startY;

		else{

		el.y = ns ? pageYOffset + innerHeight : document.documentElement.scrollTop + document.documentElement.clientHeight;

		el.y -= startY;

		}

		return el;

	}

	window.stayTopLeft=function()

	{

		if (verticalpos=="fromtop"){

		var pY = ns ? pageYOffset : document.documentElement.scrollTop;

		ftlObj.y += (pY + startY - ftlObj.y)/8;

		}

		else{

		var pY = ns ? pageYOffset + innerHeight : document.documentElement.scrollTop + document.documentElement.clientHeight;

		ftlObj.y += (pY - startY - ftlObj.y)/8;

		}

		ftlObj.sP(ftlObj.x, ftlObj.y);

		

		setTimeout("stayTopLeft()", 10);

	}

	ftlObj = ml(thediv);

	stayTopLeft();

}














