﻿window.onload = init;


function init()
{
	//eSpot Banners Setup
	var espotBannerArray = new Array();

	espotBannerArray[0] = "<a href='products#ask-mike'><img src='/images/espots/eSpot-askMike-1.gif' class='randImg' border='0' alt='Ask Mike (comming soon)'></a>";
	espotBannerArray[1] = "<a href='products#daily-quote'><img src='/images/espots/eSpot-dailyQuote-1.gif' class='randImg' border='0' alt='Daily Quote (comming soon!)'></a>";
	espotBannerArray[2] = "<a href='products#eseminar'><img src='/images/espots/eSpot-freeEseminar-1.gif' class='randImg' border='0' alt='FREE eSeminar (comming soon!)'></a>";
	espotBannerArray[3] = "<a href='products#free-report'><img src='/images/espots/eSpot-freeReport-1.gif' class='randImg' border='0' alt='FREE Report (comming soon)'></a>";
	espotBannerArray[4] = "<a href='products#passion-for-action'><img src='/images/espots/eSpot-passion-1.gif' class='randImg' border='0' alt='Passion for Action (comming soon!)'></a>";


	//Footer Banners Setup
	var footerBannerArray = new Array();

	footerBannerArray[0] = "<img src='/images/quotes/randImage-1.gif' class='randImg' border='0' alt=''>";
	footerBannerArray[1] = "<img src='/images/quotes/randImage-2.gif' class='randImg' border='0' alt=''>";
	footerBannerArray[2] = "<img src='/images/quotes/randImage-3.gif' class='randImg' border='0' alt=''>";
	footerBannerArray[3] = "<img src='/images/quotes/randImage-4.gif' class='randImg' border='0' alt=''>";
	//footerBannerArray[4] = "<img src='/images/quotes/randImage-5.gif' class='randImg' border='0' alt='In my own experience ... the secret was for leaders to remain passionate about product and selling skills and for this passion to resonate into their merchant and store ranks.'>";
	//footerBannerArray[5] = "<img src='/images/quotes/randImage-6.gif' class='randImg' border='0' alt='Osorio Group idea originated, as the vehicle to promote my initial message of Beauty, Passion, and Love to retailers, suppliers, distributors, and manufacturers throughout the country and world-wide.'>";
	//footerBannerArray[6] = "<img src='/images/quotes/randImage-7.gif' class='randImg' border='0' alt='With overall expectations for this holiday season and beyond very low, retailers are realizing they MUST differentiate to survive ... `Beauty, Passion, Love` program will help with that.'>";
	
	//Random Elements
	randomElement('footerBanner', footerBannerArray);
	//randomElement('espotBanner', espotBannerArray);
}
/**
moveLink(linkElement)

usage:
	@param linkElement : Element to apply hover CSS class
	@param type : mouseover / mouseout
	
**/
function itemMove(option, idNum)
{
	//alert(linkElement.id);
	var itemElement = document.getElementById("menuItem_" + idNum);
	var bulletImage = document.getElementById("bulletImage_" + idNum);
	
	if (option == "over")
	{
		bulletImage.className = "bullet-menu-over";
		bulletImage.src = "/images/menu_bullet-over.gif";
	}
	else if (option == "out")
	{
		bulletImage.className = "bullet-menu";
		bulletImage.src = "/images/menu_bullet.gif";
	}
}


/* this function shows the pop-up when
     user moves the mouse over the link */
function newwindow(URL)
{
		window.open(URL, "window", "scrollbars=1,toolbar=0,location=1,directories=0,status=0,menubar=0,resizeable=1,width=1000,height=800")
}

/* this function shows the pop-up when
     user moves the mouse over the link */
function Show(event, HTML)
{
	var Popup = document.getElementById('Popup');
	
	x = event.clientX + document.body.scrollLeft;
	y = event.clientY + document.body.scrollTop + 20;
	
	Popup.innerHTML = HTML;
	Popup.style.left = x+"px";
	Popup.style.top = y+"px";

	Popup.style.display = "block";
}

/* this function hides the pop-up when
 user moves the mouse out of the link */
function Hide()
{
	var Popup = document.getElementById('Popup');
	
	Popup.style.display="none";
}

function expand(type)
{
	var checkBox = document.getElementById("checkbox-TAF");
	var element = document.getElementById("hidden-" + type);

	if(checkBox.checked == true)
	{	
		element.style.display = "block";
	}
	else
	{
		element.style.display = "none";
	}
}

/**
  * Random Element
  * Randomly display HTML via provided element.
  **/
function randomElement(id,imagesArray)
{
	if (document.getElementById(id))
	{
		var element = document.getElementById(id);
	
		index = Math.floor(Math.random() * imagesArray.length);

		element.innerHTML = imagesArray[index];
	}
}

//Popup
function popup(file, p_width, p_height, sbars, loc, menus, toolb)
{
	var w = p_width;
	var h = p_height;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	
	if (!sbars) sbars = "0";
	if (!loc) loc = "0";
	if (!menus) menus = "0";
	if (!toolb) toolb = "0";
	
	windowprops = "height="+h+",width="+w+",top="+ wint +",left="+ winl +",location="+loc+", scrollbars="+sbars+",menubar="+menus+",toolbar="+toolb+",resizable=0,status=1";
	window.open(file, "Popup", windowprops);
}

function submitForm(formID)
{
	var error = false;

	if(document.getElementById(formID))
	{
		var frm = document.getElementById(formID);
		var email2 = frm.ea;
		
		if (formID == "contactFrm")
		{
			name = frm.name;
			email = frm.email;		

			if(name.value == "" || name.value == "name")
			{
				alert("Please provide your name.");
				error = true;
				name.focus();
			}

			if(email.value == "" || email.value == "e-mail")
			{
				alert("Please provide your email.");
				error = true;
				email.focus();
			}		
		}

		if (error === false && formID != "questionFrm")
		{
			popup("include/" + formID + "-thankYou.html?email=" + email2.value,500,250,0,0,0,0)
			frm.submit();
		}
		else if (formID == "questionFrm")
		{
			popup("include/" + formID + "-thankYou.html",500,250,0,0,0,0)
			frm.submit();
		}
	}
}

function clickclear(thisfield, defaulttext, type)
{
	switch (type)
	{
		case "input":
			if (thisfield.value == defaulttext)
			{
				thisfield.value = "";
			}
			break;

		case "txtArea":
			if (thisfield.innerHTML == defaulttext)
			{
				thisfield.innerHTML = "";
			}
			break;

	}
	
}

function clickrecall(thisfield, defaulttext, type)
{
	switch (type)
	{
		case "input":
			if (thisfield.value == "")
			{
				thisfield.value = defaulttext;
			}
			break;

		case "txtArea":
			if (thisfield.innerHTML == "")
			{
				thisfield.innerHTML = defaulttext;
			}
			break;

	}
}
