g_slider_left_min = -957;
g_slider_left_max = 53;
g_slider_left_cur = 53;
g_slide_onoff = 0;
g_slide_pid = null;

// Global declarations
var mid=-1;
var pheight=270;
var pwidth=234;
var ppheight=0;
var ppwidth=40;

$(document).ready(function(){
	
	$(".body_slider_left_arrow").mouseover(function(){
		start_slide(-1);
	});
	
	$(".body_slider_left_arrow").mouseout(function(){
		stop_slide();
	});
	
	$(".body_slider_right_arrow").mouseover(function(){
		start_slide(1);
	});
	
	$(".body_slider_right_arrow").mouseout(function(){
		stop_slide();
	});	
	
	$("#optin_name").focus(function(){
		if ($(this).val() == "Your name"){
			$(this).val("");
		}
	});
	
	$("#optin_email").focus(function(){
		if ($(this).val() == "Your email address"){
			$(this).val("");
		}
	});
	
	$("#optin_name").blur(function(){
		if ($(this).val() == ""){
			$(this).val("Your name");
		}
	});
	
	$("#optin_email").blur(function(){
		if ($(this).val() == ""){
			$(this).val("Your email address");
		}
	});
	
	$("#products_menu_item").mouseover(function(){
		ypSlideOutMenu.showMenu('mn_0dd');
	});
	
	$("#products_menu_item").mouseout(function(){
		ypSlideOutMenu.hideMenu('mn_0dd');
	});
	
	$("#about_menu_item").mouseover(function(){
		ypSlideOutMenu.showMenu('mn_1dd');
	});
	
	$("#about_menu_item").mouseout(function(){
		ypSlideOutMenu.hideMenu('mn_1dd');
	});
	
});

stop_slide = function(){
	g_slide_onoff = 0;
	clearInterval(g_slide_pid);
};

start_slide = function(aDirection){
	
	var token;
	
	if (aDirection > 0){
		// Slide right
		token = -10;
	} else {
		token = 10;
	}
	
	g_slide_onoff = 1;
	
	slider_action(token);
	return true;
};

slider_action = function(aToken){
	
	g_slider_left_cur = g_slider_left_cur + aToken;
	
	if (g_slider_left_cur < g_slider_left_min){
		g_slide_onoff = 0;
		g_slider_left_cur = g_slider_left_min;
	}
	
	if (g_slider_left_cur > g_slider_left_max){
		g_slide_onoff = 0;
		g_slider_left_cur = g_slider_left_max;
	}
	
	$(".slider_main_content_holder").css("left", g_slider_left_cur + "px");
	
	if (g_slide_onoff > 0){
		if (g_slide_pid){
			clearInterval(g_slide_pid);
		}
		g_slide_pid = setTimeout("slider_action("+aToken+");", 50);
	}	
	
};





/*if (document.all && !window.XMLHttpRequest){
	new ypSlideOutMenu("mn_0dd", "down", 20, 33, 300, 120);
	new ypSlideOutMenu("mn_1dd", "down", 128, 33, 150, 152);
} else {*/
	new ypSlideOutMenu("mn_0dd", "down", 370, 190, 150, 130);
	new ypSlideOutMenu("mn_1dd", "down", 870, 190, 150, 152);	
//}

var dd_vis;
var mn_images = ['tooltip','spacer'];
var mn_active = Array();

function initImages() {
	for (var i=0; i< mn_images.length; i++){
		mn_active[i]=0;
	}
}

function swapImage(element, act, evt) {
	if ( document.getElementById(element+'ddContainer') ) {
		if (act == 1)
			ypSlideOutMenu.showMenu(element+'dd');
		else
			ypSlideOutMenu.hideMenu(element+'dd');
	}
}

function actimage(id, state) {
    if (mid==id)
	state=1;
    if (state == 0) {
	return mn_images[id]+'.gif';
    } else {
	return mn_images[id]+'_.gif';
    }
}
