// JavaScript Document

var d = document;
var winIE = (navigator.userAgent.indexOf("Opera")==-1 && (d.getElementById && d.documentElement.behaviorUrns)) ? true : false;

function bodySize()
{
	var a = d.getElementsByTagName("a");

	/*for(var i=0;i<a.length;i++) if(a[i].href == d.location.href) {
		a[i].href = "javascript:void(0);";
	} */
	if(winIE && d.documentElement.clientWidth) 
	{
		sObj = d.getElementsByTagName("body")[0].style;
		sObj.width = (d.documentElement.clientWidth<700) ? "700px" : "auto";
		
	}
}

function init()
{
	if(winIE) { bodySize(); }
}

if(winIE) { onload = init; }
if(winIE) { onresize = bodySize; }
 

 

/*
jQuery(document).ready(function(){
	jQuery("a[@href$=pdf]").wrap("<div class='pdf'></div>");
});
*/

function UpdateExpandWtBlock()
{
	var bw = jQuery(document).width();
	if (bw >=1000) jQuery('#idExpandButtonBlock').show();
	else jQuery('#idExpandButtonBlock').hide();

	//ExpandTable();

}

jQuery(document).ready(function(){  
	
	try
	{
		jQuery('a.b-email-friend').fancybox({
			'overlayShow': true, 
			'frameWidth': 250, 
			'frameHeight': 150
		}); 
	}
	catch (ex)	{ }

	//UpdateExpandWtBlock();
	
});

jQuery(window).resize(function(){
	//UpdateExpandWtBlock();
});


function ExpandTable()
{
	var docWidth = parseInt(jQuery(document).width());
	//alert(docWidth);
	var	minWidth = parseInt(jQuery('#idWideTable').attr('rel'));	
	var width = minWidth + parseInt((docWidth-900)/2);
	//alert(width);
	jQuery('#idWideTable').css('width', width + 'px');
}


var hkTpsTip = function()
{
	this.tips = new Array(
		{
			key: "idTip1", 
			text: "By clicking this button you will leave the prudentspeculator.com site and enter the AFAM.tv site. TPS is a newsletter of Al Frank Asset Management, however it is available in its entirety only to paid subscribers. If you are not a subscriber and would like access please contact 877.817.4394"
		},
		{
			key: "idTip2", 
			text: 'By clicking on the "Alfrank.com" button again, you will leave the Prudent Speculator Web site and will enter Al Frank Asset Management Web site.'
		},		
		{
			key: "idTip3", 
			text: 'By clicking on the &quot;Al Frank Asset Management, Inc.&quot; link again, you will leave the Prudent Speculator Web site and will enter Al Frank Asset Management Web site.'
		}		
	);
	
	this.Bind = function()
	{
		var len = this.tips.length;
		var i = 0;

		for (i; i<len; i++)
		{

			var tip = this.tips[i];
			
			var link = '#' + tip.key + 'Link';
			var inner = '#' + tip.key + 'Inner'
		
			$(inner+ " .tip-cg").html(tip.text);
			
			$(link).click(function(tipObj, tipKey){
				return function()
				{
					tipObj.Show(tipKey);
					return false;
				}
			}(this, tip.key));
			
			$(link).mouseout(function(tipObj, tipKey){
				return function()
				{
					tipObj.Hide(tipKey);
					return false;
				}
			}(this, tip.key));
		}
	}
	
	this.Show = function(key)
	{
		var link = '#' + key + 'Link';
		var inner = '#' + key + 'Inner'
	
		if ($(inner).is(':hidden'))
		{
			$(inner).show();
		}
		else
		{
			document.location = $(link).attr('href');	
		}
	}
	
	this.Hide = function(key)
	{
		var inner = '#' + key + 'Inner'
		$(inner).hide();
	}
}

jQuery(document).ready(function(){
	var tip = new hkTpsTip();
	tip.Bind();
});

