//jQuery.noConflict();
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
};


jQuery(document).ready(function()
{
	jQuery.preloadImages("../images/nav/nav-aboutus-over.jpg", "../images/nav/nav-contact-over.jpg", "../images/nav/nav-home-over.jpg", "../images/nav/nav-news-over.jpg", "../images/nav/nav-retailers-over.jpg", "../images/nav/nav-spares-over.jpg", "../images/nav/nav-toys-over.jpg");
		
	jQuery('.prettyGallery:first').prettyGallery();
	jQuery('.prettyGallery:last').prettyGallery({
		'navigation':'top',
		'itemsPerPage':3
	});
	
});


sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function init()
{
	var inp=document.getElementsByTagName('input');
	var inpT=document.getElementsByTagName('textarea');
	
	for(var i=0; i<inp.length; i++)
	{
		if(inp[i].type=='text')
		{
			inp[i].setAttribute('rel',inp[i].defaultValue)
			inp[i].onfocus=function()
			{
				if(this.value==this.getAttribute('rel'))
				{
					this.value='';
					this.className = 'focusOn';
				} else {
					return false;
				}
			}
			inp[i].onblur=function()
			{
				if(this.value=='')
				{
					this.value=this.getAttribute('rel');
					this.className = 'focusOff';
				} else {
					return false;
				}
			}
		}
	}
	for(var i=0; i<inpT.length; i++)
	{
		if(inpT[i].type=='textarea')
		{
			inpT[i].setAttribute('rel',inpT[i].defaultValue)
			inpT[i].onfocus=function()
			{
				if(this.value==this.getAttribute('rel'))
				{
					this.value='';
					this.className = 'focusOn';
				} else {
					return false;
				}
			}
			inpT[i].onblur=function()
			{
				if(this.value=='')
				{
					this.value=this.getAttribute('rel');
					this.className = 'focusOff';
				} else {
					return false;
				}
			}
		}
	}
}

//scrollable
//########################################
// select one or more elements to be scrollable-enabled 
/*var api = jQuery("#main-content").scrollable
({
	items: '#rotator',
	size: 1,
	easing: 'swing',
	loop: false,
	nextPage: ".next",
	prevPage: ".previous",
	speed: 400,
	vertical: false,
	clickable: false
}).navigator({api: true});*/
//jQuery("#main-content").scrollable().begin();

