// JavaScript Document

jQuery.noConflict();

jQuery(function(){
    jQuery(window).bind('resize', WindowResized).trigger('resize');
});

// Window was resized
function WindowResized(e)
{
    $width = jQuery('body').width();
    
    if ($width < 1237){
        jQuery('#pngGiraffe').fadeOut(100);   
		jQuery('#pngCat').fadeOut(100);   
    } else {
        jQuery('#pngGiraffe').fadeIn(100);
		jQuery('#pngCat').fadeIn(100);
    }
    
    if ($width < 1220) {
        jQuery('#pngPenguin').fadeOut(100);
    } else {
        jQuery('#pngPenguin').fadeIn(100);
    }   
     
    if ($width < 1155) {
        jQuery('#pngMole').fadeOut(100);
    } else {
        jQuery('#pngMole').fadeIn(100);
    }
	
	if ($width < 1155) {
        jQuery('#pngGirl').fadeOut(100);
    } else {
        jQuery('#pngGirl').fadeIn(100);
    }
    
    if ($width < 1150) {
        jQuery('#pngBalloons').fadeOut(100);
		jQuery('#pngBalloons2').fadeOut(100);
    } else {
        jQuery('#pngBalloons').fadeIn(100);
		jQuery('#pngBalloons2').fadeOut(100);
    }
	
	if ($width < 1150) {
        jQuery('#pngPig').fadeOut(100);
		jQuery('#pngFlower2').fadeOut(100);
    } else {
        jQuery('#pngPig').fadeIn(100);
		jQuery('#pngFlower2').fadeIn(100);
    }
}


var mouseX = 0;
var mouseY = 0;

jQuery().mousemove( function(e) {
	mouseX = e.pageX;
	mouseY = e.pageY;
});

function showHoverImg(id,type) {
	var img = jQuery(".hoverImg");
	if (img.attr("src").indexOf(id) < 0) { //change image if not the right one
		img.attr("src","/images/"+type+"/thumbs/" + id + "_t.jpg");
	}
	img.css("top",mouseY-10 + "px");
	img.css("left",mouseX+21 + "px");
	img.show();
}



function hideHoverImg() {
	jQuery(".hoverImg").hide();
}

function openCat(id,total) {
	for (var x = 1; x<=total;x++) 
	{	
		if (x != id) 
		{
			document.getElementById("list_"+x).style.display = "";
			document.getElementById("bg_"+x).className = "";
		}
	}
	
	var cur = document.getElementById("list_"+id).style;
	var bg = document.getElementById("bg_"+id);
	cur.display =cur.display? "":"block";
	bg.className =bg.className? "":"select";
}

function BusinessDetails(type) {
	switch(type) {
		case 1:
			jQuery("#divBusinessDetails").hide();
			break;
		case 2:
			jQuery("#divBusinessDetails").show();
			jQuery("#divBusinessDetailsMore").hide();
			break;
		case 3:
			jQuery("#divBusinessDetails").show();
			jQuery("#divBusinessDetailsMore").show();
			break;
	}
}

function AddPartner() {
	var count = jQuery("#spanBusinessDetails").children().size();
	count = (count/5)+1;
	jQuery("#spanBusinessDetails").append('<div><div style="border-top:1px solid #cccccc">Name:</div><input name="iname_'+count+'" id="iname_'+count+'" type="text" size="30" /></div>');
	jQuery("#spanBusinessDetails").append('<div><div>Home Address:</div><input name="iaddress_'+count+'" id="iaddress_'+count+'" type="text" size="30" /></div>');
	jQuery("#spanBusinessDetails").append('<div><div>Home Telephone:</div><input name="itel_'+count+'" id="itel_'+count+'" type="text" size="30" /></div>');
	jQuery("#spanBusinessDetails").append('<div><div>Home Fax:</div><input name="ifax_'+count+'" id="ifax_'+count+'" type="text" size="30" /></div>');
	jQuery("#spanBusinessDetails").append('<div><div>Email:</div><input name="iemail_'+count+'" id="iemail_'+count+'" type="text" size="30" /></div>');
}


function HideShow(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"none";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"none";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"none";
}
}

