function displayInfoLayer(){
	document.getElementById("learnMore").style.display = "block";
}

function closeInfoLayer(){
	document.getElementById("learnMore").style.display = "none";
}

function sendLacrosseForm(email){
	document.getElementById("Email").value = email;
	document.getElementById("lacrosse2010Form").submit();
}

function winPopup(img){

	var mx="948px";

	var my="618px";

	PositionedWin(BASE_CONTEXT + "/model/gallery/enlargedPhoto.do?imageZoom="+img,mx,my,'fullscreen=0,scrollbars=0,status=0,menubar=0,resizable=0','copyright');

}

function getElementsByClassName( strClassName, obj ) {

    var ar = arguments[2] || new Array();

    var re = new RegExp("\\b" + strClassName + "\\b", "g");



    if ( re.test(obj.className) ) {

        ar.push( obj );

    }

    for ( var i = 0; i < obj.childNodes.length; i++ )

        getElementsByClassName( strClassName, obj.childNodes[i], ar );



    return ar;

}

function PositionedWin(url,width,height,options,name) {



  // DEFAULTS //



  var winW = 800, winH = 600;



  var winO = ',scrollbars=1,toolbar=0,location=1,directories=1,status=1,menubar=1,resizable=1';



  if (name == "email")



	  winO = ',scrollbars=1,toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=0';



  //for vertical positioning detect for IE or NN



  if ((navigator.appName == "Microsoft Internet Explorer")){



      var parOffsetX = 140, parOffsetY = 90;



  }



  else {



              var parOffsetX = 140, parOffsetY = 215;



  }



  var debug = 0; // 0 = off, 1 = on



  // PARENT WINDOW INFO //



  if (document.all) {



    var x = window.screenLeft;



    var y = window.screenTop;



    var w = window.document.body.offsetWidth;



    var h = window.document.body.offsetHeight;



  } else {



    var x = window.screenX;



    var y = window.screenY;



    var w = window.outerWidth;



    var h = window.outerHeight;



  }



  // CHILD WINDOW INFO //



  if (width) { winW = width; }



  if (height){ winH = height; }



  // some browsers don't have access to the parent's x and y coordinants



  // so default to centering the child in the center of the screen



  if ((!x && x != 0) || (!y && y != 0)) { // if x | y are NaN, default to centering in screen



    if (debug) { alert("WARNING! defaulting to centering in the screen!"); }



            var lPos = Math.round((screen.availWidth - winW) / 2);



            var tPos = Math.round((screen.availHeight - winH) / 2);



  } else {



    // if the child window will be off the screen, attempt to fix x and y so that



    // we don't run off the edge of the screen (I got varying results on this one



    // depending on what options I had turned on for the child)



    x += parOffsetX; y += parOffsetY;



    if ( (x + winW) > screen.availWidth ) { if (debug) { alert("fixing x"); } x = screen.availWidth - winW - 25; }



    if ( (y + winH) > screen.availHeight ) { if (debug) { alert("fixing y"); } y = screen.availHeight - winH - 25; }



            var lPos = x;



            var tPos = y;



  }



  if (options) {



    if (options.indexOf(',') != 0) { options = "," + options; }



    winO = options;



  }



  winO = ',width='+winW+',height='+winH+winO;



  // for overriding automatic positioning



  if (winO.indexOf("left=") == -1) {



    winO = ',left='+lPos+winO;



  }



  if (winO.indexOf("top=") == -1) {



    winO = ',top='+tPos+winO;



  }



  // sorry for the confusion, just trying to make it fool-proof



  // after all is said and done, if our winO starts with a comma, chop it off



  if (winO.indexOf(',') == 0) { winO = winO.substring(1); }



  var winName;



  if (!name) {



    var i = getRandom();



            winName = 'popup_'+i;



  } else {



    winName = name;



  }



  var newPosWindow = window.open(url, winName, winO);
  newPosWindow.focus();
  if ((navigator.appName == "Microsoft Internet Explorer" &&
      parseInt(navigator.appVersion) > 4) || (navigator.appName == "Netscape")){
      newPosWindow.focus();
  }
}

function refreshPopup(img){



	asincronicCall(location.href.replace(location.pathname + location.search,"") + BASE_CONTEXT + '/tools/GalleryPopUp/downloadWallpaper.jsp?imageZoom=' + img + '','downloadOpt');



}



function asincronicCall (url, container){



    var requestPage = false;



    if (window.XMLHttpRequest){



        requestPage = new XMLHttpRequest ();



    }else if (window.ActiveXObject){



        try{



            requestPage = new ActiveXObject ("Msxml2.XMLHTTP");



        }catch (e){



            try{



                requestPage = new ActiveXObject ("Microsoft.XMLHTTP");



            }catch (e){



            }



        }



    }



    else



    return false;



    requestPage.onreadystatechange = function (){



        loadPage (requestPage, container);



    }



    requestPage.open ('GET', url, true);



    requestPage.send (null);



}



function loadPage (requestPage, container){



    if (requestPage.readyState == 4 && (requestPage.status == 200 || window.location.href.indexOf ("http") == - 1)){



		document.getElementById (container).innerHTML = requestPage.responseText;



		if((document.getElementById('listResolution').getElementsByTagName('option').length)<1){



			document.getElementById('downloadOpt').style.display='none';



		}else{



			document.getElementById('downloadOpt').style.display='block';



		}



		if(autoRefresh)



			reloadLists();



		else



			autoRefresh = true;



	}



}

function email(){

	window.open(BASE_CONTEXT+'/tools/promotionalapp/emailtofriend.do ','emailWin','width=402,height=485,left=300,top=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes');

}



function printVersion(){

	window.open(PRINT_VERSION_LINK,"printversion_msi","toolbar=yes, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=810, height=800");

}

function changeMastheadRead() {
	var img = document.getElementById('masthead_image');
	if(img != null){
		if(img.src.indexOf('_Embargo_masthead.')!=-1){
			var newSrc = img.src.replace("_Embargo_masthead.","_masthead_btn_read_on.");
			img.src = newSrc;
		}else if(img.src.indexOf('_masthead_btn_read_on.')!=-1){
			var newSrc = img.src.replace("_masthead_btn_read_on.","_Embargo_masthead.");
			img.src = newSrc;
		}
	}
}
function changeMastheadSignup() {
	var img = document.getElementById('masthead_image');
	if(img != null){
		if(img.src.indexOf('_Embargo_masthead.')!=-1){
			var newSrc = img.src.replace("_Embargo_masthead.","_masthead_btn_sign_on.");
			img.src = newSrc;
		}else if(img.src.indexOf('_masthead_btn_sign_on.')!=-1){
			var newSrc = img.src.replace("_masthead_btn_sign_on.","_Embargo_masthead.");
			img.src = newSrc;
		}
	}
}

function openInfoUsPopUp() {
  if (BrowserDetect.browser + " " + BrowserDetect.version == "Explorer 6")
    window.open(BASE_CONTEXT + "/2011regal/specialoffer/?evar3=Regal_MHP_SignUp", "contactUsPopUp", "width=640, height=600,  toolbar=no, menubar=0, scrollbars=no, resizable=no, top=0");
  else
    window.open(BASE_CONTEXT + "/2011regal/specialoffer/?evar3=Regal_MHP_SignUp", "contactUsPopUp", "width=640, height=600, toolbar=no, menubar=0, scrollbars=no, resizable=no, top=15");
}