// scripts/theme_anime.js - Copyright Doug Ashbaugh 2009
var curImgInx=0;
var pauseAutomation = false;

function getRandNumber(max){
	try {
		var i = Math.random() * max * 10;
		//alert('i = ' + i);
		i = i % max;
		i = Math.floor(i);
		//alert('i = ' + i);
		return(i);
	} catch(e){
		alert("ERROR in function getRandNumber() " + e.message + '/' + e.name);	
	}
}

function fetchImg(i){
	try {
		var img = new Array('');
		img[0] = '/i/letsparty.jpg';
		img[1] = '/i/magglobe3.jpg';
		img[2] = '/i/classifieds.jpg';
		img[3] = '/i/vehicles2.jpg';
		img[4] = '/i/heartsblue.jpg';
		img[5] = '/i/people.jpg';
		img[6] = '/i/carnival.jpg';
		img[7] = '/i/jobsboard.jpg';
		img[8] = '/i/shopping.jpg';
		img[9] = '/i/coupons.jpg';
		return(img[i]);
	} catch(e){
		alert("ERROR in function fetchImg() " + e.message + '/' + e.name);	
	}
}

function fetchPhrase(i){
	try {
		var img = new Array('');
		img[0] = 'Party Events Finder - Find and post social events!';
		img[1] = 'Web Search - Find the best websites here!';
		img[2] = 'Classifieds - Post FREE classifieds here!';
		img[3] = 'Motors - Post FREE vehicle ads here!';
		img[4] = 'Dating - Better than FREE! Earn rewards with us!';
		img[5] = 'People Finder - Find people and classmates!';
		img[6] = 'Social Events Finder - Post your party or event for FREE!';
		img[7] = 'Job Board - Resumes and job postings are FREE!';
		img[8] = 'Shopping - Sell your goods here for FREE!';
		img[9] = 'Coupons galore - Post and find coupons and discounts.';
		return(img[i]);
	} catch(e){
		alert("ERROR in function fetchPhrase() " + e.message + '/' + e.name);	
	}
}

function getRandomImage(){
	try {
		var i=0;
		var min=0, max=9;
		var finalImg = '';
		var img = new Array('');
		i = getRandNumber(max);
		finalImg = fetchImg(i);
		//alert("Final image: " + finalImg + " for i="+i);
		return(finalImg);
	} catch(e){
		alert("ERROR in function getRandomImage() " + e.message + '/' + e.name);	
	}
}

function getNextImage(max){
	try {
		curImgInx++;
		if (curImgInx > max){
			curImgInx = 0;
		}
		finalImg = fetchImg(curImgInx);
		return(finalImg);
	} catch(e){
		alert("ERROR in function getNextImage() " + e.message + '/' + e.name);	
	}
}

function setNavMessage(msg){
	try {
		document.getElementById('divNavMsg').innerHTML = msg;
	} catch(e) {
		1;
	}
}

function clearNavMsg(msg){
	try {
		pauseAutomation = false;
		if (msg == ''){
			var img;
			var phrase;
			//img = getRandomImage();
			img = getNextImage(9);
			phrase = fetchPhrase(curImgInx);
			msg = "<table><tr><td><img src='"+img+"' /></td><td>&nbsp;</td><td style='vertical-align:middle;'>";
			msg = msg + '<b>' + phrase + '</b><br><br>';
			msg = msg + 'Welcome! Click a link at the top of the page to select a service.<br><br>';
			msg = msg + "Click the 'Go Local' link below to find other great places near you<br>to <b>Search, Surf, & Earn&#8482;</b> your way to great rewards!";
			msg = msg + "</td></tr></table>";
			setNavMessage(msg);
		} else {
			setNavMessage(msg);
		}
	} catch(e){
		alert("ERROR in function clearNavMsg() " + e.message + '/' + e.name);	
	}
}

function myInitAutomate(){
	try {
		if ( ! pauseAutomation ) {
			clearNavMsg('');
		}
		setTimeout("myInitAutomate()", 2500);
	} catch(e){
		alert("ERROR in function myInitAutomate() " + e.message + '/' + e.name);	
	}
}

function webSearchMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/magglobe3.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + "<b>Web Search - Search the Internet for the best websites!</b><br><br>Search, Surf, & Earn&#8482; your way to great prizes and rewards!<br><br>";
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function webSearchMO() " + e.message + '/' + e.name);	
	}
}
function classifiedsMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/classifieds.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>Classifieds - FREE classified ads for everyone!</b><br><br>List your stuff here for FREE!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function classifiedsMO() " + e.message + '/' + e.name);	
	}
}
function motorsMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/vehicles2.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>Motors - FREE vehicle classified ads for everyone!</b><br><br>List your vehicle here for FREE!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function motorsMO() " + e.message + '/' + e.name);	
	}
}
function datingMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/heartsblue.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>FREE dating that pays you</b> over time! We support general dating for everyone, plus ';
		msg = msg + 'special dating codes for people accepting of HSV, HPV, HIV/AIDS, or of ';
		msg = msg + 'those who are handicapped too. ';
		msg = msg + 'Never pay a cent for a dating site membership! You are always treated like gold here and ' ;
		msg = msg + 'we pay you as you Search, Surf, & Earn&#8482; your way to great rewards too! Dating here is better than FREE! Join us for FREE today!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function datingMO() " + e.message + '/' + e.name);	
	}
}
function peopleMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/people.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>People Finder - Find friends and classmates here!</b><br><br>';
		msg = msg + 'Post your own profile through the members area for FREE!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function peopleMO() " + e.message + '/' + e.name);	
	}
}
function socialMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/carnival.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>Social Events - Find parties and events here!</b><br><br>';
		msg = msg + 'Post your own parties and social events through the members area for FREE!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function socialMO() " + e.message + '/' + e.name);	
	}
}
function jobMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/jobsboard.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>Job Board - Find jobs and search resumes for talent here.</b><br><br>';
		msg = msg + 'Post your resume or job listings through the members area for FREE!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function jobMO() " + e.message + '/' + e.name);	
	}
}
function shoppingMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/shopping.jpg' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>Shopping - Find products and services at great prices here.</b><br><br>';
		msg = msg + 'Post your product or services through the members area for FREE!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function shoppingMO() " + e.message + '/' + e.name);	
	}
}
function couponsMO(){
	try {
		pauseAutomation = true;
		var msg;
		msg = "<table><tr><td><img src='/i/coupons.gif' /></td><td>&nbsp;</td><td>";
		msg = msg + '<b>Coupons - Find coupons and price alerts here!</b><br><br>';
		msg = msg + 'Find deals and help others by posting coupons and great price finds here!<br><br>';
		msg = msg + "Click the 'Join' link below to get your FREE account setup today!";
		msg = msg + "</td></tr></table>";
		setNavMessage(msg);
	} catch(e){
		alert("ERROR in function couponsMO() " + e.message + '/' + e.name);	
	}
}

/* Function for colorizing buttons in theme sets*/
function simpleBlueButtonOut(b){b.style.backgroundColor='D0FFFF';}
function simpleBlueButtonOver(b){b.style.backgroundColor='8AFFFF';}
function classicBlackButtonOut(b){b.style.backgroundColor='EFEFEF';}
function classicBlackButtonOver(b){b.style.backgroundColor='FFFF00';}
function spaceButtonOut(b){b.style.backgroundColor='EFEFEF';}
function spaceButtonOver(b){b.style.backgroundColor='FFCC00';}
//EOF