//Dreamweaver Behaviors
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//Preload tab images
MM_preloadImages('http://www.crosscomm.net/iac/web%202/images/tab-wallpapers-or.png');
MM_preloadImages('http://www.crosscomm.net/iac/web%202/images/tab-games-or.png');

var tooltip_text = [
	['ask', 'Search for anything from advice, celebrity news, sports scores and movies and get the relevant answers whenever you need them.'],
	['match', 'It\'s OK to look! Find your matches anywhere you go and get FREE wink and email alerts straight to your phone.'],
	['citysearch', 'On the go? Citysearch is too! Save time and find local business listings, read editorial and user reviews, and plan your weekend straight from our phone.'],
	['evite', 'Plan a party or stay connected to all your Evite events wherever you are!'],
	['collegehumor', 'Watch hilarious original videos, read the latest articles and browse College Humor pictures including all the Cute College Girls from class, while riding the bus... anywhere!'],
	['realestate', 'Today\'s real estate market is changing quickly. Keep up with changes on the go. Search for houses, apartments for sale and rent in the palm of your hand.'],
	['ticketmaster', 'Never miss your favorite show! With TM to Go, get event info and purchase tickets anywhere, at anytime. It\'s never been easier.'],
	['pronto', 'Know that you are getting the best deal when you are out shopping. Find what you are looking for and where to buy it.'],
	['urbanspoon', 'Get local restaurant reviews from critics, food bloggers and friends right from your phone.'],
	['zwinky', 'It\'s you in 3d.  Design your own image with the latest fashion accessories.  You can even have your sidekick pet and pick your current mood.'],
	['dictionary', 'Get smarter on the go! Dictionary.com puts world-class reference content right on your phone.'],
	['servicemagic', 'Connect instantly with customer-rated professionals in your local area for any home improvement project.']
];
$(function () { //Run when the page loads
	addToolTip();
	sendMeClick();

});

function addToolTip () {
	var logoImages = $('#logoNav li img');
	//logoImages.tooltip();
	
	logoImages.each(function() {
		var logoImageId = this.id;
		$('#'+logoImageId).tooltip({
			track: true,
			delay: 0,
			showURL: false,
			fixPNG: true,
			showBody: " - ",
			extraClass: "pretty fancy",
			top: 10,
			left: 8,
			bodyHandler: function() {
				var toolTipText = '';
				for(var i=0; i<tooltip_text.length; i++){
					if(tooltip_text[i][0] == logoImageId){
						toolTipText = tooltip_text[i][1]; 
					}
				}
				$('#toolTipContent').html('').append(toolTipText);
				return $('#toolTipWrapper');
			}
		});
	});
}

function sendMeClick () {
	var content = $('#sendmeContent div');
	content.hide();
	$('#sendmeNav span').removeClass('active');
	$('#sendmeContent div:first').show();
	$('#sendmeNav span:first').addClass('active');
	$('#sendmeNav span').click(function() {
		$('#sendmeNav span').each (function (){
			$(this).removeClass('active');
		});
		$(this).addClass('active');	
		var divClass = $(this).parent().attr('class');
		content.each(function(){
			if ($(this).hasClass(divClass))	{
				content.hide();
				$(this).show();
				}			  	
		});
		
	});
	
}

