jQuery.noConflict();

jQuery(document).ready(function(){
	/* These functions are for the drop down boxes
	   .drop_contacts => .contacts
	   .drop_address => .address
	
	img/view_company_address_up.gif
	img/view_senior_contacts_up.gif
	
	*/
	
	
	
		
	// Hide all .address and .contacts
	jQuery(".address, .contacts").hide();
	
	// drop_contacts functions
	jQuery(".drop_contacts").click(function(){
		var c = jQuery(this);
		var contact_show = c.find("~ .contacts:visible").length;
		var address_show = c.find("~ .address:visible").length;
		
		// IF the contact is shown...
		if(contact_show == 1){
			c.find("~ .contacts").slideUp();
			
			c.find("> img").attr("src", "img/view_senior_contacts_up.gif");
			
		}
		
		//IF the contact isnt shown...
		if(contact_show == 0){
			c.find("~ .address").slideUp(function(){
				c.find("~ .contacts").slideDown();
				
				c.find("> img").attr("src", "img/view_senior_contacts_down.gif");
				if(address_show == 1){
					jQuery(".drop_address img").attr("src", "img/view_company_address_up.gif");
				}
			})
		}
		
		return false;
	})
	
	jQuery(".drop_address").click(function(){
		var c = jQuery(this);
		var contact_show = c.find("~ .contacts:visible").length;
		var address_show = c.find("~ .address:visible").length;
		
		// IF the address is shown...
		if(address_show == 1){
			c.find("~ .address").slideUp();
			
			c.find("> img").attr("src", "img/view_company_address_up.gif");
			
		}
		
		//IF the address isnt shown...
		if(address_show == 0){
			c.find("~ .contacts").slideUp(function(){
				c.find("~ .address").slideDown();
				
				c.find("> img").attr("src", "img/view_company_address_down.gif");
				if(contact_show == 1){
					jQuery(".drop_contacts img").attr("src", "img/view_senior_contacts_up.gif");
				}
				
			})
		}
		
		return false;
	})
	
	
	
	/* <----  ----> */
	jQuery(".sh").hover(
		function(){
			var t = jQuery(this).attr("src");
			var t = t.split(".");
			var t = t[0].split("_");
			var newname = t[0]+"_up.jpg";
			jQuery(this).attr("src", newname);
		},
		function(){
			var t = jQuery(this).attr("src");
			var t = t.split(".");
			var t = t[0].split("_");
			var newname = t[0]+"_down.jpg";
			jQuery(this).attr("src", newname);
		}
	)
	
})
