/**	Scripts file for XXX
 * 	Written by Phil Smart of 'Phil Smart Design' unless otherwise indicated.
 *	http://www.philsmartdesign.com.au
 */	

/*
 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
 * http://benalman.com/projects/jquery-dotimeout-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);
/* End doTimeout*/


$(document).ready(function(){
	/*
	$.doTimeout(3000, function(){	
		for(y=1; y<35; y++){
				
				var varItem = Math.floor(Math.random() * 34) + 1;
				var thumbnail = 'img.vipLogoTop#vip' + varItem;	
				//var varTime = Math.floor(Math.random() * 4000);
				
				//if(varTime < 1000){varTime += 2000;}
							//console.log(varTime);			

				$(thumbnail).doTimeout(1000,function(){
					$(this).animate({opacity:0}, 2000, function(){
						$(this).delay(1500).animate({opacity:1}, 2000);
						return true;
					});
				});							
		};
	
	return true;
	});	
	*/	
		
		
		/*
		$.doTimeout(1000, function(){		
			for(x=1; x<35; x++){	
				var varItem = Math.floor(Math.random() * 34) + 1;
				var varTime = Math.floor(Math.random() * 25000);
				if(varTime < 3000){varTime += 3000;}
				var thumbnail = 'img.vipLogoTop#vip' + x;

					$(thumbnail).doTimeout(varTime, function(){
						$(this).animate({opacity:0}, 1000, function(){
							$(this).delay(2000).animate({opacity:1}, 1000);
							return true;
						});
					});						
			};
		return true;
		});
		*/

	//Navigation hover script
	$('.imageFadeWrapTop img').hover(function(){
		$(this).stop().animate({opacity:0}, 800);		
	}, function(){
		$(this).stop().animate({opacity:1}, 500);
	});
	
	//VIP thumbnail hover effect
	//$('img.vipLogoTop').hover(function(){
	//	$(this).stop().animate({opacity:0}, 200);		
	//}, function(){
	//	$(this).stop().animate({opacity:1}, 300);
	//});
	
	
	
	
	//png fix application	
	$(document).pngFix();
});









/******************** Pre Loaded Rollover Script **************************************/
// img tags are as follows;
//<img src="images/vertFacebookBTN.png" id="vertFacebookBTN" onMouseOver="over(0);" onMouseOut="out(0);">
//in this example, initial img is 'vertFacebookBTN.png' and rollover is 'vertFacebookBTNHover.png'
//both are stored in the "images/" directory

var revert = new Array();
// Array inames holds element ID's which are same as filename
var inames = new Array('vertFacebookBTN', 'vertMyspaceBTN', 'vertTwitterBTN');

// Preload
if (document.images) {
  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
	//image is replaced with the following
    flipped[i].src = "images/"+inames[i]+"Hover.png";  	
  }													
}

function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}

function out(num) {
  if(document.images) document.images[inames[num]].src = revert[num];
}


