/* Intrinsix 'West' JS, JQuery version*/
/* Based on X-Universal-4.4 UIX */
/* By Xiao, Roxanne, Remy, Lana, J, Abby @ Intrinsix, 2007-2009 */
/* Thanks to Rick Rutter and Stu Pasqual for aid, comfort and peppermint tea. */
/* Copyright 2009 Intrinsix, but if you want it, ask. */

/* JQuery Functions */
/* Callback eggMe function for K-Code, bitches. */
function eggMe() { $.growlUI('J&#117;&#115;&#116;&#032;&#098;&#101;&#099;&#097;&#117;&#115;&#101;&#032;&#119;&#101;&#032;&#117;&#115;&#101;&#032;&#099;&#104;&#101;&#097;&#116;&#115;', '&#100;&#111;&#101;&#115;&#110;&#39;&#116;&#032;&#109;&#101;&#097;&#110;&#032;&#119;&#101;&#39;&#114;&#101;&#032;&#110;&#111;&#116;&#032;&#115;&#109;&#097;&#114;&#116;!', 8000); }

/* Universal CSS-based Pulse, Blink and YFT via $ (much slicker this way, thanks J) */
$(document).ready(function(){ $('.pulse').pulse({ opacity: [0.4,1] }, {  duration: 1200, times: 100 });  }); 
$(document).ready(function(){ $('.blink').pulse({ opacity: [0,1] }, {  duration: 1200, times: 1000 });  }); 
$(document).ready(function(){ $('.yf').pulse({ opacity: [1,0] }, {  duration: 1200, times: 1 });  }); 

/* Home page slide sprites (client logos) */
$(document).ready(function(){ var x = 0; while (x<1000) { slidesprites(); x++; } });


/* Fetch a random logo and matching descriptive text. */
function setLogo() {
	var logos0=['Bank of America Corporate','Verizon','Guajarita Resorts','Sub Pop Records','University of California Davis','BC Ferries Corporation','Air Canada']
	var logos1=['Sun Life Financial', 'Telcel (Am&eacute;rica M&oacute;vil)', 'Cipherhouse West', 'Paramount Pictures', 'Zara', 'New York University', 'Gov\'t of Saskatchewan (Canada)']
	var logos2=['Scotiabank', 'AAA Auto Club', 'GlaxoSmithKline plc','MTV Networks','Labatt Brewing Company Ltd.','Hydro Qu&eacute;bec (Canada)','Gov\'t of Canada']
	var logos3=['Royal Bank of Scotland', 'The Girl Scouts','Hoogendoorn','Virgin Media','Thon Hotels','BC Hydro (Canada)','Gov\'t of Manitoba (Canada)']
	var logos4=['Citibank Financial','Nike','The Coca-Cola Company','Apple','Hilton Hotels','BCLC (Canada)','Aloha Airlines']
	var logos5=['Hong Kong Bank of Canada','New York Life Insurance','Santa Clara University','Nishimoto Trading Company','Stony Brook University [NY]','MLCC (Canada)','Singapore Airlines']
	var logos6=['Bank of Ireland','Rogers Communications','Royal Cruise Lines','Pfizer Inc.', 'Monsanto','Fujita Kaniko Hotels','Northwest Airlines']
	var logos7=['Tiger Airlines','Wind Telecom','Muchmusic (CHUM Interactive)','Shoewawa','Sassy Couture','Elysium Wealth Management','Watson/Parker LLC']
	
	var xRand = Math.floor(Math.random()*7);
	var yRand = Math.floor(Math.random()*8);
	var xPos = -1 - xRand*181;
	var yPos = -1 - yRand*101;	
	
	args = xPos + "px " + yPos + "px";
	$('#logos').css('background-position',args);
	$('#logos p').html(eval('logos' + (yRand))[xRand]);
}

/* Fade out the existing sprite, fade in a new random one */
function slidesprites() { $('#logos').pulse({ opacity: [1,0] }, {  duration: 3000, times: 1, complete: function() { setLogo(); } }); }

/* Global topnav needs a sticky highlight sub-selector */
$(document).ready(function() {
$("ul#topnav li.a").hover(function() { $(this).css({ 'background' : '#993333'}); $(this).find("span").show();} , function() { $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); });
$("ul#topnav li.b").hover(function() { $(this).css({ 'background' : '#5b4d7f'}); $(this).find("span").show();} , function() { $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); });
$("ul#topnav li.c").hover(function() { $(this).css({ 'background' : '#336699'}); $(this).find("span").show();} , function() { $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); });
$("ul#topnav li.d").hover(function() { $(this).css({ 'background' : '#ce703b'}); $(this).find("span").show();} , function() { $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); });
$("ul#topnav li.e").hover(function() { $(this).css({ 'background' : '#339999'}); $(this).find("span").show();} , function() { $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); });
$("ul#topnav li.f").hover(function() { $(this).css({ 'background' : '#f3d23c'}); $(this).find("span").show();} , function() { $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); });
});


