// JavaScript Document 
/* Page used: Contact.php, HGI locations tab - Jquery script parses GoogleMapdata.xml data */

$(document).ready(function(){
	 /* HGI drop-down contact form box */		   
	 $('.box-hgi').hide();
	  $('#dropdown-hgi').change(function() {
	    $('.box-hgi').hide();
	    $('#div' + $(this).val()).slideDown("slow").show();
	 });
	  
	  /* Lami Glass drop-down contact form box */
	 $('.box-lam').hide();
	  $('#dropdown-lam').change(function() {
	    $('.box-lam').hide();
	    $('#div' + $(this).val()).slideDown("slow").show();
	 });
	  
	 /* AGalite drop-down contact form box */
	 $('.box-ag').hide();
	  $('#dropdown-ag').change(function() {
	    	$('.box-ag').hide();
	    	$('#div' + $(this).val()).slideDown("slow").show();
	 });

	 
//	  $('.box-ag').mouseleave(function() {
//		$('.box-ag').hide();
//	   	$('#div' + $(this).val()).hide();
//	    
//	 });
	 
	  
	  
  
	//// HGI SEATTLE #1		   
	$.ajax({
	       
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='1') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Hartung\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea1,#divarea-lam2 ');
			    }
			});
		}
	});
	//// Lami Can #2		   
	$.ajax({
	       
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='2') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Lami Canada\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-lam1');
			    }
			});
		}
	});
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='3') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Hartung\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea2');
			    }
			});
		}
	});
	//// Union City, CA #5
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='5') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Hartung\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea3');
			    }
			});
		}
	});
	//// SAC, CA #6
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='6') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Hartung\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea4');
			    }
			});
		}
	});
	//// Utah, #6
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='4') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Hartung\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea5');
			    }
			});
		}
	});

	//// Ag-Pueblo, #7
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='7') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Agalite\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-ag5');
			    }
			});
		}
	});
	//// Ag- NB Indiana , #8
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='8') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Agalite\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-ag4');
			    }
			});
		}
	});

	//// Ag- Arlington TX, #9
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='9') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Agalite\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-ag2');
			    }
			});
		}
	});

	//// AG, Anaheim, CA #10
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='10') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Agalite\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-ag1');
			    }
			});
		}
	});

	//// AG, CANADA #11
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='11') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Agalite Canada\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-ag3');
			    }
			});
		}
	});
		//// AG, Seattle #11
	$.ajax({
		type: "GET",
		url: "xml/GoogleMapData.xml",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('marker').each(function(){
			if($(this).attr('label')=='12') {
				var name = $(this).attr('name');
				var address = $(this).attr('address');
				var address1 = $(this).attr('address1');
				var phone = $(this).attr('phone');
				var phone1 = $(this).attr('phone1');
				var email = $(this).attr('email');
				//var brief = $(this).find('brief').text();
				//var long = $(this).find('long').text();
				$('<ul>').html('<u>Location</u>:<li>' + name + '</li>' + '<li>' + address + '</li>' + '<li>' + address1 + '</li>' +'<br><u>Phone</u>:' +'<li>'+ phone + '</li>'+'<li>'+ phone1 + '</li><br><u>Email</u>:' 
					       + '<li>' +  '<form><input type=\'button\' value=\'Contact Agalite\' onClick=\"location.href=\'mailto:' + email +'\'\"></form>' + '<li>').appendTo('#divarea-ag6');
			    }
			});
		}
	});
//		$.ajax({
//			type: "GET",
//			url: "xml/GoogleMapData.xml",
//			dataType: "xml",
//			success: function(xml) {
//				$(xml).find('marker').each(function(){
//				if($(this).attr('label')=='2') {
//					var id = $(this).attr('id');
//					var name = $(this).attr('name');
//					var address = $(this).attr('address');
//					var address1 = $(this).attr('address1');
//					var phone = $(this).attr('phone');
//					var phone1 = $(this).attr('phone1');
//					//var brief = $(this).find('brief').text();
//					//var long = $(this).find('long').text();
//					$('<div class="TabContentTitle"></div>').html(id).appendTo('.TabContentWrapper');
//					$('<div class="TabContentCopy"></div>').html(name).appendTo('.TabContentWrapper');
//					$('<div class="TabContentCopy"></div>').html('<br>'+address).appendTo('.TabContentWrapper');
//					$('<div class="TabContentCopy"></div>').html('<br>'+address1).appendTo('.TabContentWrapper');
//					$('<div class="TabContentCopy"></div>').html('<br>Ph: '+phone).appendTo('.TabContentWrapper');
//					$('<div class="TabContentCopy"></div>').html('<br>Ph: '+phone1).appendTo('.TabContentWrapper');
//					//$('<div class="TabContentCopy"></div>').html('<br>'+long).appendTo('.TabContentWrapper');
//				       //$('<div id="link_'+id+'"></div>').html('<a href="'+url+'">'+title+'</a>').appendTo('#page-wrap');
//				    }
//				});
//			}
//		});		

});