//GLOBAL VARIABLES

//PLUGINS
$.fn.clearForm = function() {
  return this.each(function() {
 var type = this.type, tag = this.tagName.toLowerCase();
 if (tag == 'form')
   return $(':input',this).clearForm();
 if (type == 'text' || type == 'password' || tag == 'textarea')
   this.value = this.defaultValue;
 else if (type == 'checkbox' || type == 'radio')
   this.checked = false;
 else if (tag == 'select')
   this.selectedIndex = 0;
  });
};


//RUN ON PAGE LOAD FUNCTIONS
$(document).ready(function(){	
	//BUTTONS HOVER
	buttonHover();
	//CUFON
	Cufon.replace(".companyname", {fontFamily:"Helvetica Neue"});
	Cufon.replace(".toptext,#btn_readmore,h1,.btn_sidemenu", {fontFamily:"DIN"});
	//Cufon.replace(".bannercufontext", {fontFamily:"Franklin Gothic"});
	//IFIXPNG
	//loadedCallbackFunction();
	
	
});

//ALL BUTTONS HOVER ESTATE
function buttonHover()
{
	$("div[id^='btn']").hover(function(){
		$(this).addClass("hover");							  
	}, function(){
		$(this).removeClass("hover");											
	});

	$("input[id^='btn']").hover(function(){
		$(this).addClass("hover");							  
	}, function(){
		$(this).removeClass("hover");											
	});
	//SPECIAL - SUBPAGE HOVER
	$("li div[class^='btn']").hover(function(){
		$(this).parent().parent().addClass("hover");									 
	}, function(){
		$(this).parent().parent().removeClass("hover");									 
	});
	//BUTTONS INSIDE CANVA
	$(".canva div[class^='btn']").hover(function(){
		$(this).addClass("hover");							  
	}, function(){
		$(this).removeClass("hover");											
	})
}

//INPUTS DEFAULT VALUE
function inputs()
{
	$(".inputBox").each(function(){
		$(this).focus(function(){
			var dvalue = $(this)[0].defaultValue;
			if ($(this).val() == dvalue)
			$(this).val("");
		});
		
		$(this).blur(function(){
			var dvalue = $(this)[0].defaultValue;
			if ($(this).val() == "")
			$(this).val(dvalue);
		});
	});	
}


//loadedCallbackFunction() - FUNCTION TO FIX PNG IN IE6
function loadedCallbackFunction(){	
	//FIX PNG IN IE6
	$('img').ifixpng();
	$('div').each(
		function(){
			if($(this).css("background-image").indexOf('png') != -1){
				$(this).ifixpng();
			}
		}
	);
}

