function changeScreenSize(w,h,left,top)
{
	window.resizeTo(w,h)
	window.moveTo(left, top)
}

function CreateBookmarkLink()
{
	var urlAddress = "http://www.kaykbayz.com";
	var pageName = "Kay.K.BayZ.com - Official Website";

	if(window.sidebar)
	{
		window.sidebar.addPanel(pageName, urlAddress,"");
	}
	else if(window.external)
	{
		window.external.AddFavorite(urlAddress,pageName)
	}
	else if(window.opera && window.print)
	{
		return true;
	}
	else
	{ 
		alert("Sorry! Your browser doesn't support this function.");
	}
}

function emptyEBox(obj)
{
	var val = obj.value;
	if(val == "email")
		obj.value='';
}

function pageLoader(value,category,page)
{
	if(category == "productType" && page == "add")
	{
		window.location = "addProduct.php?prodType="+value;
	}

	if(category == "value" && page == "add")
	{
		window.location = "addProduct.php?value="+value;
	}

	if(category == "productType" && page == "mod")
	{
		window.location = "modifyProduct.php?prodType="+value;
	}

	if(category == "value" && page == "mod")
	{
		window.location = "modifyProduct.php?value="+value;
	}
}

function goThere(address,email,type)
{
	if(type=='remFromBl')
		var result = window.confirm("Are you sure you want to remove "  + email + " from the blacklist?");

	if(type=='blacklist')
		var result = window.confirm("Are you sure you want to blacklist "  + email + "?");

	if(type=='site_status')
		var result = window.confirm("Are you sure you want to change the status of the site to: " + email + "?");

	if(result==true)
		window.location=address;
}

function toggleArea(brw,page)
{
	if(brw == 'MSIE')
	{
		if(page == "beverages")
		{
			document.getElementById('beverages').style.display = 'block';
			document.getElementById('foods').style.display = 'none'
		}

		if(page == "foods")
		{
			document.getElementById('beverages').style.display = 'none';
			document.getElementById('foods').style.display = 'block'
		}
	}
	else
	{
		if(page == "beverages")
		{
			document.getElementById('beverages').style.visibility = 'visible';
			document.getElementById('foods').style.visibility = 'collapse'
		}

		if(page == "foods")
		{
			document.getElementById('beverages').style.visibility = 'collapse';
			document.getElementById('foods').style.visibility = 'visible'
		}
	}
}

function get_date()
{
	var d_names = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");

	var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

	var d = new Date();
	var curr_day = d.getDay();
	var curr_date = d.getDate();
	var sup = "";

	if (curr_date == 1 || curr_date == 21 || curr_date ==31)
	{
		sup = "st";
	}
	else if (curr_date == 2 || curr_date == 22)
	{
		sup = "nd";
	}
	else if (curr_date == 3 || curr_date == 23)
	{
		sup = "rd";
	}
	else
	{
		sup = "th";
	}

	var curr_month = d.getMonth();
	var curr_year = d.getFullYear();

	document.write(d_names[curr_day] + " " + curr_date + "<SUP>"
	+ sup + "</SUP> " + m_names[curr_month] + " " + curr_year);
}

function showInfo() {
	document.getElementById("infoBox").style.display = 'block';
}

function hideInfo() {
	document.getElementById("imagebox").style.display = 'none';
}

function showExtraMenu(obj,e)
{
	var mousepos=Array();
	mousepos=GetMouseCoords(e);

	//if it's too close to the right of screen
	if(mousepos[0]>750)
		mousepos[0]=mousepos[0] - 383;

	//if it's too close to the bottom of screen
	if(mousepos[1]>500)
		mousepos[1]=mousepos[1] - 315;

	document.getElementById('theimage').src=obj;
	document.getElementById('imagebox').style.left=mousepos[0];
	document.getElementById('imagebox').style.top=mousepos[1];
	document.getElementById('imagebox').style.display="block";
}

function GetMouseCoords(e)
{
	e = (e) ? e : window.event;
	
	var x = 0;
	var y = 0;
	
	if(e.pageX)
	{
		x = e.pageX;
		y = e.pageY;
	}
	
	else if(e.clientX)
	{
		x = e.clientX + document.body.scrollLeft;
		y = e.clientY + document.body.scrollTop;
	}
	
	return new Array(x, y);
}


/*
Script made by Martial Boissonneault © 2001-2002 http://getElementById.com/
This script may be used and changed freely as long as this msg is intact
Visit http://getElementById.com/ for more free scripts and tutorials.
*/
timerID = null;
var active = 0;

function ChangePage(num){
    	if(document.getElementById){
    		obj[active].style.visibility = "hidden";
    		active = num;
    		obj[active].style.top = 0;
    		obj[active].style.visibility = "visible";
    	}
}
    
function ScrollUp(speed){
    	if(document.getElementById){
    		if(parseInt(obj[active].style.top) < 0){
    			obj[active].style.top = parseInt(obj[active].style.top) + speed + "px";
		}
    		timerID = setTimeout("ScrollUp("+speed+")",30);
    	}
}

function ScrollDown(speed){
    	if(document.getElementById){                        
    		if(parseInt(obj[active].style.top) > document.getElementById('cont').offsetHeight - obj[active].offsetHeight){ 
    			obj[active].style.top = parseInt(obj[active].style.top) - speed + "px";
		}
    		timerID = setTimeout("ScrollDown("+speed+")",30);
    	}
}

function ScrollStop(){
    	if(document.getElementById){
    		clearTimeout(timerID);
    	}
}

function ScrollPageInit() {
    	if(document.getElementById){
    		obj = document.getElementById("cont").getElementsByTagName("div");
    		obj['page1'].style.visibility = "visible";
    		obj['page1'].style.top = 0;	
    	}	
    	if(document.addEventListener){
    		for(i=0;i<document.getElementsByTagName('a').length;i++){
    			document.getElementsByTagName('a')[i].style.position = "relative";
		}
    	}
}