/*@cc_on 
	@if (@_win32)
	try {document.execCommand('BackgroundImageCache', false, true);}catch(e){}
	@end
	@if (@_jscript_version >= 5.5 && @_jscript_version <= 5.6)
			var clear="/image/home_pics/clear.gif";
			pngfix=function(){var els=document.getElementsByTagName("*");var ip=/\.png/i;var i=els.length;while(i-->0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=="no-repeat")?"crop":"scale";es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+"px";es.backgroundImage="none";var elkids=el.getElementsByTagName("*");if(elkids){var j=elkids.length}}}}};
			$(function(){pngfix();});
	@end
@*/

var FC = {
	vars : {
		flashPathTest : 'swf/Pru.swf',
		flashPathLive : '/Prudential/swf/Pru.swf'
	}
};

var fcFunctions = {
	ajaxLoader : function(o) {
		var list = o.list;
		var parent = o.parent;
		var elementToHide = o.elementToHide;
		var xml;
		
		$(list).find("a").bind("click", function () {
			
			var url= $(this).attr("href");
			//var destination = url + " .feature-container";
			var destination = url + " .feature";
			var myClass= $(this).parent().attr("id");
			//var container= $(parent).find(".feature-container");
			var container= $(parent);
			var grandparent= $(parent).parent();
			
			container.animate({opacity: 0}, 500, function () {
					if ($(parent).hasClass("stage-1") || $(parent).hasClass("stage-2") || $(parent).hasClass("stage-3")) {
						$(parent).removeClass().addClass("feature");
					}
					$(parent).addClass(myClass);
					
					if (!$(grandparent).hasClass("off-home")) {
						$(grandparent).addClass("off-home");
					}
					container.empty();
					container.load(destination, function(){
						loadSifr();
						 fcFunctions.ajaxLoader({
							list : ".stages",
							parent : ".feature",
							elementToHide : ".feature"
						});
					});
					
					if ($(parent).hasClass("stage-1")) {
						xml= "swf/xml/images.xml"
 document.getElementById("soon").style.display="none";
 document.getElementById("already").style.display="none";
 document.getElementById("plan").style.display="none";
document.getElementById("think").style.display="block";

 document.getElementById("soonR").style.display="none";
 document.getElementById("alreadyR").style.display="none";
 document.getElementById("planR").style.display="none";
document.getElementById("thinkR").style.display="block";

document.getElementById("HomeLeft").style.display="none";
document.getElementById("AlreadyLeft").style.display="none";
document.getElementById("RetireLeft").style.display="none";
document.getElementById("AheadLeft").style.display="block";

document.getElementById("HomeRight").style.display="none";
document.getElementById("AlreadyRight").style.display="none";
document.getElementById("RetireRight").style.display="none";
document.getElementById("AheadRight").style.display="block";

dcsMultiTrack('DCS.dcsuri','/homepage-thinking-ahead.html','WT.ti','Thinking Ahead');

					}

					
					else if ($(parent).hasClass("stage-2")) {
						xml = "swf/xml/images2.xml"
 document.getElementById("already").style.display="none"
document.getElementById("think").style.display="none";
 document.getElementById("plan").style.display="none";
document.getElementById("soon").style.display="block";

document.getElementById("alreadyR").style.display="none"
document.getElementById("thinkR").style.display="none";
 document.getElementById("planR").style.display="none";
document.getElementById("soonR").style.display="block";

document.getElementById("HomeLeft").style.display="none";
document.getElementById("AlreadyLeft").style.display="none";
document.getElementById("RetireLeft").style.display="block";
document.getElementById("AheadLeft").style.display="none";

document.getElementById("HomeRight").style.display="none";
document.getElementById("AlreadyRight").style.display="none";
document.getElementById("RetireRight").style.display="block";
document.getElementById("AheadRight").style.display="none";	

dcsMultiTrack('DCS.dcsuri','/homepage-retiring-soon.html','WT.ti','Retiring Soon');
				}
							
					else if ($(parent).hasClass("stage-3")) {
						xml= "swf/xml/images3.xml"
document.getElementById("think").style.display="none";
 document.getElementById("plan").style.display="none";
document.getElementById("soon").style.display="none";
document.getElementById("already").style.display="block";

document.getElementById("thinkR").style.display="none";
 document.getElementById("planR").style.display="none";
document.getElementById("soonR").style.display="none";
document.getElementById("alreadyR").style.display="block";

document.getElementById("HomeLeft").style.display="none";
document.getElementById("AlreadyLeft").style.display="block";
document.getElementById("RetireLeft").style.display="none";
document.getElementById("AheadLeft").style.display="none";

document.getElementById("HomeRight").style.display="none";
document.getElementById("AlreadyRight").style.display="block";
document.getElementById("RetireRight").style.display="none";
document.getElementById("AheadRight").style.display="none";

dcsMultiTrack('DCS.dcsuri','/homepage-already-retired.html','WT.ti','Already Retired');
					}		
					
					var func = function () {
						$('.feature').animate({opacity: 1}, 500, function(){
							var __unique = "";											  
																		  
							/*@cc_on
								__unique = "?" + new Date();
							@*/											  
																		  
							var flashvars = {}; 
							var params = {
								flashvars : 'xmlPath=' + xml,
								wmode: 'transparent'
							};
							var attributes = {};
							swfobject.embedSWF(FC.vars.flashPathTest + __unique, 'flash', '358', '329', '9', '#F6FDFF', flashvars, params, attributes);
						});
					};
					
					var def = setTimeout(func,200);
				}
			);
			
			//wait for page to finish loading and then run the rollover function again
		//	setTimeout("fcFunctions.rollover({parent: 'ul.stages a'})",800);
			
			return false;	//prevent default action	
		});
    },
	
	glossary : function(o){
		
		var details = o.details;
		var list = o.list;

		$(list).removeClass("selected");	
		$(details).addClass("off");
		
		$(list).find("h3").bind("click", function(){

			fcFunctions.glossaryAppear({
				glossaryItem: $(this),
				glossaryDetails: details,
				glossaryList: list
			});
			return false;

		});
		
		$(list).find("span.toggle").bind("click", function(){

			fcFunctions.glossaryAppear({
				glossaryItem: $(this),
				glossaryDetails: details,
				glossaryList: list
			});
			return false;

		});
	},
	
	glossaryAppear : function(o){
		
			var glossaryItem = o.glossaryItem;
			var glossaryDetails = o.glossaryDetails;
			var glossaryList = o.glossaryList;
			
			var thisDetails = glossaryItem.parent().parent().find(".details");
			var selected = glossaryItem.parent().parent().hasClass("selected");
			
			if(selected!=true){
				$(glossaryList).removeClass("selected");
				$(glossaryDetails).addClass("off");
				
		
		$(".toggle a").empty().append("Show");
				glossaryItem.parent().parent().addClass("selected");
				$(thisDetails).removeClass("off");
				$(thisDetails).hide();
				$(thisDetails).fadeIn(800);
				glossaryItem.parent().parent().find(".toggle a").empty().append("Hide");
					glossaryItem.parent().parent().find(".toggle a").addClass("hide");
			}
			else{
				$(thisDetails).fadeOut(800, function(){
					$(thisDetails).hide();
					$(glossaryList).removeClass("selected");
					$(glossaryDetails).addClass("off");	
					glossaryItem.parent().parent().find(".toggle a").empty().append("Show");
					glossaryItem.parent().parent().find(".toggle a").removeClass("hide");
				});
				
			}
			
	},
	
/*	rollover : function (o) {
		var parent= o.parent;
		
		$(parent).hover(
	    	function () {
				var el= $(this).find("img");
				var src= $(el).attr("src");
				
				//split the src into two bits from the . (i.e. imagename.gif)
				//first index is imagename
				//second index is gif
				var src= src.split('.png');
								
				//add "-over" to the end of the image name
				src[0]= src[0] + "-over";
				
				//set the src attribute to the new value (with -over added on)
				$(el).attr("src", function () {
	          		return src[0]+".png";
				})
			}, 
      		function () {
			var el= $(this).find("img");
				var src= $(el).attr("src");
				
				//find the position of "-over" in the src attribute
				var location= src.search('-over');
				if (location != -1) {
					//if '-over' was found, change the src string to everything from the first character
					//to the position where "-over" begins, and add ".gif" to the end
					src= src.substring(0,location)+".png"
				
					//set the src attribute to the new value (-over removed)
					$(el).attr("src", function () {
	          			return src
					})
				}
      		}
    	);

	},
	*/
	

	printLink:function(){

		var anc = document.createElement("a");
		anc.className="print";
		anc.href="javascript:self.print();";
		var span = document.createElement("span");
		anc.appendChild(span);
		anc.appendChild(document.createTextNode("Print page"));
		$("ol.breadcrumb").before(anc);
		
	},
	reveal : function (o) {
		var el= o.element;
		
		$(el).bind("click", function () {
			
			$(this).parent().find("li.accessible").fadeOut("fast", function () {
				$("li.accessible").removeClass("accessible").fadeIn(1000);
				$(el).addClass("accessible");
			})
			return false;
		})
	}
};


function hiddenContent() {
	var target= $(".target");
	$(target).removeClass("target").addClass("accessible");
}


function gup( name ){  
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href ); 
if( results == null )    return "";
else
return results[1];
}
	var campaign_param="0";
	campaign_param = gup( 'WT.srch' );
	if(campaign_param=="1"){	
	         document.cookie = 'wtPaidSearch=1;path=/';
	}

if(campaign_param=="1" || campaign_param=="2" || campaign_param=="3"){		        
		   var expireDate = new Date()
	         expireDate.setDate(expireDate.getDate()+90)
	         document.cookie = 'Redesign_Exit_Survey_cookie=y;expires='+expireDate.toGMTString()+ ';path=/';
	}



// jS for rotating banners
// ==============================================
// Copyright 2003 by jsCode.com
// Source: jsCode.com
// Author: etLux
// Free for all; but please leave in the header.
// ==============================================

// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array. Rememeber
// to increment the theImages[x] index!

theImages[0] = '/image/background_images/promo7.jpg'
theImages[1] =  '/image/background_images/promo5.jpg'
theImages[2] =  '/image/background_images/promo6.jpg'
theImages[3] = '/image/background_images/promo8.jpg'

// ======================================
// do not change anything below this line
// ======================================

var j = 0
var p = theImages.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}






(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","visible");
		});
	}
})(jQuery);






