//----------------------------------------------------------------------------------------------------
//-- Opens Generic Locked Window
//----------------------------------------------------------------------------------------------------
function openGenericLockedWindow(loc, newWidth, newHeight){
	var reportWindow

	reportWindow = window.open(loc, 'report', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=' + newWidth + ',height=' + newHeight);
	reportWindow.focus();
}	


//----------------------------------------------------------------------------------------------------
//-- Opens Generic Unlocked Window
//----------------------------------------------------------------------------------------------------
function openGenericUnLockedWindow(loc, newWidth, newHeight){
	var reportWindow

	reportWindow = window.open(loc, 'report', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=' + newWidth + ',height=' + newHeight);
	reportWindow.focus();
}


//----------------------------------------------------------------------------------------------------
//-- Allow user to bookmark a specific page.  Used in Support Sections.  Link is on the sidebar
//----------------------------------------------------------------------------------------------------


function bookmark()
{
	if (document.all)
		{
			window.external.AddFavorite(location.href, document.title); return false
		}
}

//----------------------------------------------------------------------------------------------------
//-- Clears the default text from a text box...text box calls funtion onFocus
//----------------------------------------------------------------------------------------------------


function clearTextBox(obj)
{
	obj.value = "";
}

//----------------------------------------------------------------------------------------------------
//-- Pre loads images
//-- To use type the following on a page:
//-- jsLoadImages('/enterfoldername/enterimagename.gif or jpg',
//--              '/enterfoldername/enterimagename.gif or jpg');
//----------------------------------------------------------------------------------------------------
var images = new Array();

function jsLoadImages(){ 
	for (var i=0; i < jsLoadImages.arguments.length; i++){
		images[i] = new Image();
		images[i].src = jsLoadImages.arguments[i];
	}
}

//----------------------------------------------------------------------------------------------------
//-- Redirect the browser to the url provided
//----------------------------------------------------------------------------------------------------


function redirectBrowser(url)
{
	location.href = url;
}

//----------------------------------------------------------------------------------------------------
//-- Check for enter key and set focus and click object provided
//----------------------------------------------------------------------------------------------------


function CheckFormEnter(e, sButtonName)
{
	var characterCode;

	if(e && e.which)
	{ 
		e = e;
		characterCode = e.which; // (for NN4 support)
	}
	else
	{
		e = event;
		characterCode = e.keyCode; // (for IE)
	}

	if(characterCode == 13) //(ascii 13 - enter key)
	{
		
		var button = document.getElementById(sButtonName);
		
		button.focus();
		button.click();
	}

	return true;
}

//----------------------------------------------------------------------------------------------------
//-- For lead gen forms to show/hide state based on country
//----------------------------------------------------------------------------------------------------

function ShowHideState(stateWrapperId, countryValue, stateDropDownList)
{
	//get the select list for the stateWrapper
	var wrp = document.getElementById(stateWrapperId);
	var ddl = document.getElementById(stateDropDownList);

	if (countryValue == 'US' || countryValue == "CA")
	{
		
		wrp.style.display = "block";
		ddl.selectedIndex = 0;
		
	}
	else
	{
		wrp.style.display = "none";
		ddl.selectedIndex = 1;
	}
}

//----------------------------------------------------------------------------------------------------
//-- RollOn/RollOff functionality
//----------------------------------------------------------------------------------------------------
function rOn(imgName,type,dup) {
	
	// the variable dup is used only when you need to roll more than one instance of the same file
	// on the same page, otherwise the function assumes the filename and the id are the same value
	
	if(!dup) {
	  if( document.getElementById ) { // this is the way the standards work
		elem = document.getElementById( imgName ); }
	  else if( document.images ) {// this is the way old msie versions work
		elem = document.images[imgName];  }
	  else if( document.layers ) {// this is the way nn4 works
		elem = document.layers[imgName]; }
	} else {
	  if( document.getElementById ) { // this is the way the standards work
		elem = document.getElementById( dup ); }
	  else if( document.images ) {// this is the way old msie versions work
		elem = document.images[dup];  }
	  else if( document.layers ) {// this is the way nn4 works
		elem = document.layers[dup]; }
	}
	  elem.src = '/shared/images/'+ imgName + '_on.' + type;
}

function rOff(imgName,type,dup) {

	if(!dup) {
	  if( document.getElementById ) { // this is the way the standards work
		elem = document.getElementById( imgName ); }
	  else if( document.images ) {// this is the way old msie versions work
		elem = document.images[imgName];  }
	  else if( document.layers ) {// this is the way nn4 works
		elem = document.layers[imgName]; }
	} else {
	  if( document.getElementById ) { // this is the way the standards work
		elem = document.getElementById( dup ); }
	  else if( document.images ) {// this is the way old msie versions work
		elem = document.images[dup];  }
	  else if( document.layers ) {// this is the way nn4 works
		elem = document.layers[dup]; }
	}
		
	  elem.src = '/shared/images/'+ imgName + '.' + type;
//	  elem.src = 'http://pdxsitecore01/shared/images/'+ imgName + '.' + type;
}

//----------------------------------------------------------------------------------------------------
//-- jQuery init block
//----------------------------------------------------------------------------------------------------

function launchr() {
$(document).ready(function() {
$(document).pngFix();		
			   
// setupZoom();
//	$('a.fz').fancyZoom({scaleImg: true, closeOnClick: true});
// alert("seen");
//	$('div.photo a').fancyZoom({scaleImg: true, closeOnClick: true});
//	$('#medium_box_link').fancyZoom({width:400, height:300});
//	$('#large_box_link').fancyZoom();
//	$('#flash_box_link').fancyZoom();
});
}

//----------------------------------------------------------------------------------------------------
//-- Optimize Conversion Call
//----------------------------------------------------------------------------------------------------
function optimizeConversion(testAlias, convEvent) {
	//var _lpo2 = WM.conversion(testAlias, {conversionPoint: convEvent}); 
	var _lpo2 = WM.conversion(testAlias, {conversionPoint: convEvent, cookieDomain: ''},this); 
	var url = window.location.pathname;
	
	if(_lpo2.z8db1e8caac() != null) {
		_tag.DCSext.wm_testid = _lpo2.getParams()['moniker'];
		_tag.DCSext.wm_runid = _lpo2.z8db1e8caac();
		_tag.DCSext.wm_experimentid = _lpo2.z8db1e8caac() + "-" + _lpo2.z2160ab07ce();
		_tag.DCSext.wm_conversion = _lpo2.getParams()['conversionPoint'];
	}

	dcsMultiTrack ('DCS.dcsuri',url,'WT.i_wm_conversion',_tag.WT.i_wm_conversion,'WT.dl','1');
}

//----------------------------------------------------------------------------------------------------
//-- New Open Exchange Content Flip
//----------------------------------------------------------------------------------------------------


function conSwitch(page)
{
   var block1 = document.getElementById("block1");
   var block2 = document.getElementById("block2");

   if (page == 1)
   {
       block1.style.display="none";
       block2.style.display="block";
   }

   if (page == 2)
   {
       block1.style.display="block";
       block2.style.display="none";
   }
}

