// preload the menu images //
about_us_pic= new Image(); 
about_us_pic.src="./images/abt-us-bg-img.jpg";
projects_pic= new Image(); 
projects_pic.src="./images/our-project-img.jpg";
news_pic= new Image(); 
news_pic.src="./images/news-bg-img.jpg";
contact_us_pic= new Image(); 
contact_us_pic.src="./images/contact-us-bg-img.jpg";

main_menu_pic= new Image(); 
main_menu_pic.src="./images/menu-img.png";
abt_menu_pic= new Image(); 
abt_menu_pic.src="./images/menu-about-us-on.png";
projects_menu_pic= new Image(); 
projects_menu_pic.src="./images/menu-projects-on.png";
news_menu_pic= new Image(); 
news_menu_pic.src="./images/menu-news-on.png";
contact_menu_pic= new Image(); 
contact_menu_pic.src="./images/menu-contact-us-on.png";

contact_loading_pic= new Image();
contact_loading_pic.src="./images/form-loading.gif";

projects1_menu_pic= new Image();
projects1_menu_pic.src="./images/project-titles-img-on.jpg";
projects2_menu_pic= new Image();
projects2_menu_pic.src="./images/project-titles-img.jpg";

// contact us functions //
function sendContactFields(){
	var contact_name = document.getElementById("contact_name").value;
	var contact_email = document.getElementById("contact_email").value;
	var contact_telephone = document.getElementById("contact_telephone").value;
	var contact_message = document.getElementById("contact_message").value;
	
	var containtHTML_div = document.getElementById("messageDiv");
	containtHTML_div.innerHTML = "<img src='./images/form-loading.gif' alt='' />";
	
	$.ajax({
	      url: "contact-us-send.php",
	      global: false,
	      type: "POST",
	      data: "name="+contact_name+"&email="+contact_email+"&telephone="+contact_telephone+"&message="+contact_message,
	      dataType: "html",
	      success: function(msg){
	      	 if(msg == '1'){
	      	 	document.getElementById("contact_name").value="";
	      	 	document.getElementById("contact_email").value="";
	      	 	document.getElementById("contact_telephone").value="";
	      	 	document.getElementById("contact_message").value="";
	      	 	
	         	containtHTML_div.innerHTML = '<span style="color: green;">Your message has been sent successfully.<\/span>';
	         	return false;
	         }else{
	         	containtHTML_div.innerHTML = '<span style="color: red;">'+msg+'<\/span>';
	         	return false;
	         }
	      },
		  error: function(msg){
		  	
			alert("Something wrong happened! Please try again later.");
	        return false;
		  }
	   }
	)
}

function clearContactFields(){
	document.getElementById("contact_fname").value="";
 	document.getElementById("contact_lname").value="";
 	document.getElementById("contact_email").value="";
 	document.getElementById("contact_telephone").value="";
 	document.getElementById("contact_country").value="";
 	document.getElementById("contact_message").value="";
 	return false;
}
//// fancy to call ////
function fancyBoxToCall(){
	$(document).ready(function() {
		$("a[rel=projectsDivImages_group]").fancybox({
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});

	});
}
///////////////////////
