
if(siteName == 'wpni'){
	var currentPage = location.href
	currentPage = currentPage.replace('wpni','wpd');
	location.replace(currentPage);
}else if(siteName=='nw'){
	location.replace('http://www.newsweek.com/');
}else if(siteName=='bt'){
	location.replace('http://www.budgettravel.com/');
}else if(siteName=='sprig'){
	location.replace('http://www.sprig.com/');
}else if(siteName=='gg'){
	location.replace('http://www.girlgetaways.com/');
}else if(siteName=='le'){
	location.replace('http://www.washingtonpost.com/wp-adv/media_kit/wpd/index.html');
}

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4257 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}))

function getScreen(){
	var rootElement = (document.compatMode != 'BackCompat')?document.documentElement:document.body;
	this.windowheight = rootElement.clientHeight;
	this.windowwidth = rootElement.clientWidth;
}
function setSizes(){
	getScreen();
	if (document.getElementById('dimScreen') != undefined){
	document.getElementById('dimScreen').style.height = (windowheight) + "px";
	document.getElementById('dimScreen').style.width = (windowwidth) + "px";
	}
	if (document.getElementById('ak_modal_div') != undefined){
	document.getElementById('ak_modal_div').style.height = (windowheight - 150) + "px";
	document.getElementById('ak_modal_div').style.width = (windowwidth - 300) + "px";
	}
	if (document.getElementById('ak_modal_bio') != undefined){
	document.getElementById('ak_modal_bio').style.height = (windowheight - 184) + "px";
	document.getElementById('ak_modal_bio').style.width = (windowwidth - 300) + "px";
	}
	if (document.getElementById('ak_modal_table') != undefined){
	document.getElementById('ak_modal_table').style.width = (windowwidth - 300) + "px";
	}
}
jQuery.extend({
    dimScreen: function(speed, opacity, callback) {
        if(jQuery('#dimScreen').size() > 0) return;
        
        if(typeof speed == 'function') {
            callback = speed;
            speed = null;
        }
        if(typeof opacity == 'function') {
            callback = opacity;
            opacity = null;
        }
        if(speed < 1) {
            var placeholder = opacity;
            opacity = speed;
            speed = placeholder;
        }
        if(opacity >= 1) {
            var placeholder = speed;
            speed = opacity;
            opacity = placeholder;
        }
        speed = (speed > 0) ? speed : 500;
        opacity = (opacity > 0) ? opacity : 0.5;
        return jQuery("<div></div>").attr({
                id: 'dimScreen'
                ,fade_opacity: opacity
                ,speed: speed
            }).css({
            background: '#000'
            ,height: $(document).height() + 'px'
            ,left: '0px'
            ,opacity: 0
            ,position: 'absolute'
            ,top: '0px'
            ,width: $(document).width() + 'px'
            ,zIndex: 999
        }).appendTo(document.body).fadeTo(speed, 0.7, callback);
    },
    dimScreenStop: function(callback) {
        var x = jQuery('#dimScreen');
        var opacity = x.attr('fade_opacity');
        var speed = x.attr('speed');
        x.fadeOut(speed, function() {
            x.remove();
            if(typeof callback == 'function') callback();
        });
    }
});
jQuery.extend({
	showAkModal:function(navurl,title,bioDiv,box_width,box_height)
	{
		document.getElementsByTagName("html")[0].style.overflow = "hidden";
	    var offset={};
	    var options ={
	    margin:1,
	    border:1,
	    padding:1,
	    scroll:0
	    };
		var win_width =$(window).width();
	    var scrollToLeft=$(window).scrollLeft();
	    var win_height =$(window).height();
	    var scrollToBottom=$(window).scrollTop();
		var bio = $('#'+bioDiv).html();
		if(!navurl.match('.htm'))
		{
	    	$('body').append("<div id='ak_modal_div' style='padding-top:0px;border:1px solid black;background-color:#FFF;position: absolute;z-index:1000;display:none;'><table id='ak_modal_table' cellpadding='0' cellspacing='0' width='" + box_width + "'><tr><td style='width:100%'><strong>"+title+"</strong></td><td style='vertical-align:top'><div id='close'></div></td></tr></table><div class='bio' id='ak_modal_bio' style='width:" + box_width + "px;height:" + box_height + "px;overflow:scroll'><div class='wrapper' id='bodyBG'>" + bio + "</div>");
		}
		else {
			$('body').append("<div id='ak_modal_div' style='padding-top:0px;border:1px solid black;background-color:#FFF;position: absolute;z-index:1000;display:none;'><table cellpadding='0' cellspacing='0' width='" + box_width + "'><tr><td style='width:100%'><strong>"+title+"</strong></td><td style='vertical-align:top'><div id='close'></div></td></tr></table><iframe width='"+box_width+"' height='"+box_height+"'  frameborder=0 marginwidth='0' marginheight='0' scrolling='NO'  name='frmTest' src='"+navurl+"'></iframe></div>");
		}
	    $('#ak_modal_div').css({left:(((win_width/2-box_width/2))+scrollToLeft)+'px',top:(((win_height/2-box_height/2))+scrollToBottom)+'px'});
	    $('#close').click( function() {
			document.getElementsByTagName("html")[0].style.overflow = "auto";
	       $('#ak_modal_div').fadeOut(500);
	       $('#ak_modal_div').remove();
	        $.dimScreenStop();
	    });
	    $.dimScreen(500, 0.7, function() {
			$('#ak_modal_div').fadeIn(500);
	    });
		var offset = {}
	    offset=$("#ak_modal_div").offset({ scroll: false })
  	    X_left=offset.left+box_width-16;
	    X_top=offset.top;
	    $('#close').css({left:X_left,top:X_top});
	},
	akModalRemove:function()
	{
	   $('#ak_modal_div').fadeOut(100, function(){
			$(this).remove();
		});
	   document.getElementsByTagName("html")[0].style.overflow = "auto";
	  $.dimScreenStop();
	},
	akModalHideAndRedirect:function(redirect_url)
	{
	    $('#ak_modal_div').fadeOut(500);
	    $.dimScreenStop();
	    window.location=redirect_url;
	}
});	

var lvl2nav = {
	slm: function(_this,_bool){
		_this=_this.parentNode;
		if(!document.body.className.match(_this.id)){
			if(_bool=='click'){
				x=_this.getElementsByTagName('a')[0].href.split('/');
				location.href='http://www.washingtonpost.com/wp-adv/media_kit/' + siteName + '/' + x[x.length-1]
			}
			_this.style.backgroundPosition = (_bool)?'0 -54px':'0 0';
		}
		
	},
	exec: function(){
		$(".livearea").click( function(){lvl2nav.slm(this,'click');});
		$(".livearea").mouseover( function(){lvl2nav.slm(this,true);});
		$(".livearea").mouseout( function(){lvl2nav.slm(this,false);});
		$("#print").click( function(){printPage();});
		$("#print").mouseover(function(){$("#print").css('backgroundPosition','0 -54px')});
		$("#print").mouseout(function(){$("#print").css('backgroundPosition','0 0')});
	}
}



function printPage() {
	window.print()
}

function shots()
{
	var site = siteName;
	if(site=='twp'){site='wp';var was_changed=true};
	var siteLinks =
	{ 
		"wp":["wp","http://www.washingtonpost.com"],
		"bm":["bm","http://www.thebigmoney.com"],
		"le":["le","http://loudounextra.washingtonpost.com"],
		"slate":["slate","http://www.slate.com"],
		"theroot":["theroot","http://www.theroot.com"],
		sites:['wp','bm','le','slate','theroot']
	} 
	if(!siteLinks[site] )
	{
		site = siteLinks.sites[Math.floor(siteLinks.sites.length * Math.random())];
	}	
	var shot = document.getElementById('shot');
	var what = document.getElementById('what');
	var shotIndex = Math.round(Math.random()*2);	
	shot.src = "http://www.washingtonpost.com/wp-adv/ms/media/images/screenShots/" + "ss_" + site + "_0" + shotIndex + ".jpg"
	shot.onclick = function(){ window.open(siteLinks[site][1]) }
	what.className = site;
	if(was_changed && site=='wp'){site='twp';}
}


function addEvent(_function,_event) {
	var _onload = window.onload;
	var _onresize = window.onresize;
	if ( typeof window.onload != 'function' ) {
		if ( window.onload ) {
			window.onload = _function;
		} else {
			var _addEventListener = window.addEventListener || document.addEventListener;
			var _attachEvent = window.attachEvent || document.attachEvent;
			if ( _addEventListener ) {
				_addEventListener(_event, _function, true);
				return true;
			} else if ( _attachEvent ) {
				var _result = _attachEvent('on'+_event, _function);
				return _result;
			} else {
				//todo: preloading fix for ie5.2 on mac os
				return false;
			}
		}
	} else {
		window.onload = function() {
			_onload();
			_function();
		}
	}
}


var BrowserDetect = {
	init: function () {
		BrowserDetect.browser = BrowserDetect.searchString(BrowserDetect.dataBrowser) || "An unknown browser";
		BrowserDetect.version = BrowserDetect.searchVersion(navigator.userAgent)
			|| BrowserDetect.searchVersion(navigator.appVersion)
			|| "an unknown version";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [{string: navigator.userAgent, subString: "Firefox", identity: "Firefox"},
				  {string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE"},
				  {string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv"},
				  {string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla"},
				  {string: navigator.vendor, subString: "Apple", identity: "Safari"}]
};


function link_target()
{
	var links=$('#page a')
	for(var a = 0; a < links.length; a++)
	{
		if( !( (links[a].href.match(/media_{0,1}kit/) && links[a].href.match('www.washingtonpost.com')) || links[a].href.match('window.open') ) || links[a].href.match('.pdf')  )	{
			links[a].target='_blank';
		}
	}
}


var rootElement = (document.compatMode != 'BackCompat')?document.documentElement:document.body;
var vivify = {  
	'visuals' : {
	'allbrowsers': {
		'allsites':[
				['#content','width','490'],
				['#contentShadow1','width','488'],
				['#contentShadow2','width','486'],
				['#contentShadow3','width','484'],
				['#contentShadow4','width','482'],
				['#contentShadow5','width','480'],
				['#contentShadow6','width','478'],
				['#contentShadow7','width','476'],
				['#contentShadow8','width','474']
			]
		},
	
	'default' : {
		'allsites':[
			['#content','height','45'],
			['#contentOpaqueArea','height','45'],
			['#contentShadow1','height','43'],
			['#contentShadow2','height','41'],
			['#contentShadow3','height','39'],
			['#contentShadow4','height','37'],
			['#contentShadow5','height','35'],
			['#contentShadow6','height','33'],
			['#contentShadow7','height','31'],
			['#contentShadow8','height','29'],
			['#contentTopBg','width','490'],
			['#fade2','width','490'],
			['#hi','height','375'],
			['#nav','height','30'],
			['#shotBG','height','330'],
			['#shotShadow1','height','330'],
			['#shotShadow2','height','330'],
			['#shotShadow3','height','330'],
			['#shotShadow4','height','330']
		],
		'sites': {			
				'bm':[['#page','height','303']],
				'wpd':[['#page','height','211']],
				'le':[['#page','height','243']],
				'slate':[['#page','height','288']],
				'theroot':[['#page','height','256']],
				'wp':[['#page','height','256']],
				'twp':[['#page','height','256']],
				'wpd':[['#page','height','260']]
			}
		},
		 
	'Explorer7' : {
		'allsites':[
			['#content','height','54'],
			['#contentOpaqueArea','width','489'],
			['#contentShadow1','height','52'],
			['#contentShadow2','height','50'],
			['#contentShadow3','height','48'],
			['#contentShadow4','height','46'],
			['#contentShadow5','height','44'],
			['#contentShadow6','height','42'],
			['#contentShadow7','height','40'],
			['#contentShadow8','height','38'],
			['#contentTopBg','width','489'],
			['#fade2','width','489'],
			['#hi','height','370'],
			['#nav','height','40'],
			['#page','width','489'],
			['#shotBG','height','340'],
			['#shotShadow1','height','340'],
			['#shotShadow2','height','340'],
			['#shotShadow3','height','340'],
			['#shotShadow4','height','340']
		],
		'sites': {
				'bm':[
					['#page','height','309'],
					['#contentOpaqueArea','height','54']],
				'le':[
					['#page','height','249'],
					['#contentOpaqueArea','height','54']],
				'slate':[
					['#page','height','299'],
					['#contentOpaqueArea','height','54']],
				'theroot':[
					['#page','height','273'],
					['#contentOpaqueArea','height','54']],
				'wp':[
					['#page','height','259'],
					['#contentOpaqueArea','height','60']],
				'twp':[
					['#page','height','259'],
					['#contentOpaqueArea','height','60']],
				'wpd':[
					['#page','height','266'],
					['#contentOpaqueArea','height','60']]
			}
		},
	
	'Explorer6' : {
		'allsites':[
			['#content','height','55'],
			['#contentOpaqueArea','height','55'],
			['#contentShadow1','height','53'],
			['#contentShadow2','height','51'],
			['#contentShadow3','height','49'],
			['#contentShadow4','height','47'],
			['#contentShadow5','height','45'],
			['#contentShadow6','height','43'],
			['#contentShadow7','height','41'],
			['#contentShadow8','height','39'],
			['#hi','height','370'],
			['#nav','height','40'],
			['#shotBG','height','340'],
			['#shotShadow1','height','340'],
			['#shotShadow2','height','340'],
			['#shotShadow3','height','340'],
			['#shotShadow4','height','340']
		],
		'sites': {
				'bm':[['#page','height','309']],
				'le':[['#page','height','249']],
				'slate':[['#page','height','299']],
				'theroot':[['#page','height','274']],
				'wp':[['#page','height','259']],
				'twp':[['#page','height','259']],
				'wpd':[['#page','height','267']]
			}
		}
	},
	init: function(){
		var windowheight = rootElement.clientHeight;
		var windowwidth = rootElement.clientWidth;
		
		document.body.style.height = (windowheight - 20) + 'px';
		document.body.style.width = (windowwidth - 20) + 'px';
		
		if (windowheight < 408){$('#fade').css('display','none');} else {$('#fade').css('display','block');}
		if(vivify.visuals.allbrowsers && vivify.visuals.allbrowsers.allsites){
			vivify.executeVisualHack(vivify.visuals.allbrowsers.allsites,windowheight,windowwidth);
		}
		var site = siteName;
		if(site=='twp'){site='wp';var site_change=true}
		if(vivify.visuals.allbrowsers.sites && vivify.visuals.allbrowsers.sites[site]){
			vivify.executeVisualHack(vivify.visuals.allbrowsers.sites[site],windowheight,windowwidth);
		}
		var browser = BrowserDetect.browser + BrowserDetect.version;
		if(vivify.visuals[browser] && vivify.visuals[browser].allsites){
			vivify.executeVisualHack(vivify.visuals[browser].allsites,windowheight,windowwidth);
			if(vivify.visuals[browser].sites[site]){
				vivify.executeVisualHack(vivify.visuals[browser].sites[site],windowheight,windowwidth);
			}
		} else if (vivify.visuals['default'].allsites){
			vivify.executeVisualHack(vivify.visuals['default'].allsites,windowheight,windowwidth);
			if(vivify.visuals['default'].sites && vivify.visuals['default'].sites[site]){
				vivify.executeVisualHack(vivify.visuals['default'].sites[site],windowheight,windowwidth);
			}
		}
		if (BrowserDetect.browser == "Safari"){
			$('#page').css('overflow','scroll');
			$('img.info').css('margin-top','0px');
		}
		function detectMac(){
		  var ua = navigator.userAgent.toLowerCase();
		  if(ua.indexOf("mac") != -1){
			return true;
		  }
		  return false;
		}
		if(detectMac()==true){
			document.body.className += ' mac';
		}
		if(site_change && site=="wp"){site='twp'}
	},
	executeVisualHack: function (hackArray,windowheight,windowwidth){
			for (a=0;hackArray[a];a++){
				var windowaxis = (hackArray[a][1] == 'height') ? windowheight : windowwidth;
				$(hackArray[a][0]).css(hackArray[a][1],(windowaxis - hackArray[a][2]) + "px");
			}
	}
}

swfobject.embedSWF('http://www.washingtonpost.com/wp-adv/ms/media/swf/propertyMenu.swf','flashNav','450','290','9.0.0','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash',{dpage:siteName},{menu:"false",quality:"high",wmode:"transparent",allowscriptaccess:"always",type:"application/x-shockwave-flash"},{id:'flashmenu',name:'flashmenu'})

addEvent(BrowserDetect.init,'load');
addEvent(lvl2nav.exec,'load');
addEvent(link_target,'load');
addEvent(shots,'load');
addEvent(vivify.init,'load');
addEvent(vivify.init,'resize');


//function to create subnav for press releases
function prNav(){

$('head').append('<style type="text\/css" media="screen">.table_row { display:none }<\/style>');

var prDate = document.getElementById('year').childNodes[0].childNodes[0].childNodes[0].nodeValue;
$('*[date]').each(function(){
	if(prDate == $(this).attr('date').split('/')[2])
	{
		$(this).css('display','block');
	}
});

$("li[class='yr'] a").each(function(){
	var yr = $(this).text();
	if(yr == prDate)
	{
		$(this).attr('class','clk').css('color','#000');
	}
});

$("li[class='yr'] a").click(function () { 
	
	$("li[class='yr'] a").css({'color':$(this).css('color')});
	
	$("li[class='yr'] a").attr('class','clkOff');
	$(this).attr('class','clk').css('color','#000');
	
	var yr = $(this).text();
	$('*[date]').each(function(){
	if(yr == $(this).attr('date').split('/')[2])
	{
		$(this).css('display','block');
	}
	else {
		$(this).css('display','none');
	}
	});
});

$("#all").click(function () { 
	$('*[date]').css('display','block')
});

}

if(document.getElementById('year')){
prNav()
}

//Netmining code
document.write('<s\cript src="http://wapo.netmng.com/?aid=069&tax=media_kit" type="text/javascript" defer="defer"></s\cript>');



