$(document).ready(function() {
	
	// supposed to fix .png transparency in IE 6
	$('body').supersleight({shim: 'http://www.my-internet-payday.com/scripts/x.gif'});
	//$('body').supersleight({shim: 'http://www.my-internet-payday.com/scripts/x.gif'});
	
	// searching for flickr images on the edit profile page
	$("#btnOrder").mouseover(function () {
		$(this).attr('class','btnOrderOver');
	});
	$("#btnOrder").mouseout(function () {
		$(this).attr('class','btnOrder');
	});
	$("#btnOrder").mousedown(function () {
		$(this).attr('class','btnOrderDown');
	});
	$("#btnOrder").mouseup(function () {
		$(this).attr('class','btnOrderOver');
	});
	$("#btnFlashExit").click(function () {
		hideFlash();
	});
	//*
	$("#flashWindow01").flash({
	    src: 'flash/GooglePayday1.swf',
	    width: 150,
	    height: 282
	})
	$("#flashWindow02").flash({
	    src: 'flash/GooglePayday2.swf',
	    width: 300,
	    height: 565
	})
	$("#flashWindow03").flash({
	    src: 'flash/GooglePayday2.swf',
	    width: 225,
	    height: 424
	})
	$("#flashWindow04").flash({
	    src: 'flash/GooglePayday2.swf',
	    width: 149,
	    height: 280
	})
	//*/
	$("#btnOrder").click(function () {
		DisableVSAChat();
		validate_form();
	});
	$("#closeMsgWindow").click(function () {
		$("#messages").hide();
		return false;
	});
	
	
	
	// set a timer to hide the flash
	// 60 seconds if we are on the index page
	// 30 seconds for the order page
	var flash = document.getElementById('flashWindow01');
	if (flash){
		setTimeout ( 'hideFlash()', 53000 );
	} else {
		setTimeout ( 'hideFlash()', 138000 );
	}
	
	// SHOW MEMBER CONTENT WHEN THEY ROLL OVER THE BONUS DIV
	$("#showMemberBonus").mouseover(function () {
		$("#showMemberBonus").attr('id','hideMemberBonus');
		$("#hideMemberBonus").animate({right:'200px'});
		$("#memberBonus").show().animate({width:'200px'});
	});
	// HIDE THE MEMBER CONTENT WHEN THE ROLL OUT OF IT
	$("#memberBonus").mouseout(function () {
		$("#hideMemberBonus").animate({right:'0px'}, 500, 'linear', function() {
		});
		$("#memberBonus").animate({width:'0px'}, 500, 'linear', function() {
			$(this).hide();
			//$("#hideMemberBonus").attr('id','showMemberBonus');
		});
	});
	
	// links with a rel=external need to open in a popup
	$('A[rel="external"]').click( function() {
		var className = $(this).attr("class");
		var sizeArray = className.split(",");
		var width = sizeArray[0];
		var height = sizeArray[1];

        window.open( $(this).attr('href'),"Window1","menubar=no,width="+width+",height="+height+",toolbar=no" );
        return false;
    });
	
	// links with a rel=external need to open in a popup
	$('A[rel="externaltool"]').click( function() {
		var className = $(this).attr("class");
		var sizeArray = className.split(",");
		var width = sizeArray[0];
		var height = sizeArray[1];

        window.open( $(this).attr('href'),"Window1","menubar=0,width="+width+",height="+height+",toolbar=1,scrollbars=1" );
        return false;
    });
	
	
});

function hideFlash(){
	$("#flashContent").remove();
	$("#flashContentOrder").remove();
}