google.load('jquery',1.3);	// Load jQuery

var shareLink = function(linkName) {
	var shareURL = null;
	var shareLink = 'http://www.pedigree.com/03Adoption/superbowl/Default.aspx';
	var shareTitle = encodeURIComponent('PEDIGREE(r) Super Bowl ad and "Crazy Pet" videos');
	var shareDescription = encodeURIComponent('Hey, dog lovers! Ever wonder what it would be like to own a pet rhino? Or a bison&hellip;or a boar&hellip;or an ostrich? To find out, take a look at the new Super Bowl ad and "Crazy Pet" videos from PEDIGREE&reg;. You\'ll be glad you got a dog!');
	
	switch (linkName) {
		case 'Myspace':			shareURL = 'http://www.myspace.com/index.cfm?fuseaction=postto&t='+shareTitle+'&c='+shareDescription+'&u='+shareLink+'&l=2';	break;
		case 'Facebook':		shareURL = 'http://www.facebook.com/sharer.php?u='+shareLink+'&t='+shareTitle;																								break;
		case 'Delicious':		shareURL = 'http://del.icio.us/post?url='+shareLink+'&title='+shareTitle;																											break;
		case 'Digg':				shareURL = 'http://www.digg.com/submit?phase=2&url='+shareLink;																																break;
		case 'Live':				shareURL = 'https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url='+shareLink+'&title='+shareTitle;								break;
		case 'Yahoo':				shareURL = 'http://myweb.yahoo.com/myresults/bookmarklet?t='+shareTitle+'&u='+shareLink+'&ei=UTF';														break;
	}
	
	popupWindow(shareURL,'share_pedigree',850,600,'yes');
};

var popupFullDetails = function() { popupWindow('full_details.html','Full_Details',450,350,'yes'); }

var popupWindow = function(url,name,width,height,scroll) {
	if (scroll==null) { scroll = 'no'; }
	leftPosition = (screen.width) ? (screen.width-width) / 2 : 0;
	topPosition = (screen.height) ? (screen.height-height) / 2 : 0;
	settings = 'height='+height+',width='+width+',top='+topPosition+',left='+leftPosition+',scrollbars='+scroll+',resizable';
	win = window.open(url,name,settings)
};

var logVideoCount = function(videoName) {
	$.get('superbowl_video_count.aspx',{'videoName':videoName});
	spotlightTag(videoName);
};

var spotlightTag = function(tagName) {
	var axel = Math.random();
	var a = axel * 10000000000000;

	switch (tagName) {
		//case 'LP':					$('#Spotlight_Container').html('<img src="http://ad.doubleclick.net/activity;src=1448607;type=q1200461;cat=q1200467;ord=1;num='+ a + '?" width="1" height="1" border="0" alt="" style="position:absolute">'); break;
		case 'Bison':				$('#Spotlight_Container').html('<img src="http://ad.doubleclick.net/activity;src=1448607;type=q1200821;cat=adopt888;ord=1;num='+ a + '?" width="1" height="1" border="0" alt="" style="position:absolute">'); break; // Video 1
		case 'Ostrich':			$('#Spotlight_Container').html('<img src="http://ad.doubleclick.net/activity;src=1448607;type=q1200821;cat=adopt358;ord=1;num='+ a + '?" width="1" height="1" border="0" alt="" style="position:absolute">'); break; // Video 2
		case 'Boar':				$('#Spotlight_Container').html('<img src="http://ad.doubleclick.net/activity;src=1448607;type=q1200821;cat=adopt819;ord=1;num='+ a + '?" width="1" height="1" border="0" alt="" style="position:absolute">'); break; // Video 3
		case 'Rhino':				$('#Spotlight_Container').html('<img src="http://ad.doubleclick.net/activity;src=1448607;type=q1200821;cat=adopt077;ord=1;num='+ a + '?" width="1" height="1" border="0" alt="" style="position:absolute">'); break; // Video 4
		case 'Super_Bowl':	$('#Spotlight_Container').html('<img src="http://ad.doubleclick.net/activity;src=1448607;type=q1200821;cat=adopt982;ord=1;num='+ a + '?" width="1" height="1" border="0" alt="" style="position:absolute">'); break; // Video 5
	}
	
	//if (tagName!='LP') { omnitureEventTrack(tagName); }
}

var omnitureEventTrack = function(eventName) {
	/*
		void(s.t());
		s_pageName = "SuperBowl Video - "+eventName;
		s.t();
		alert(s_pageName);
	*/
}

google.setOnLoadCallback(function() {
	spotlightTag('LP');
});