
	
	
	function init()
	{
		$("#assets_assending").click(function()
		{
			return aj( current_page() + "/element/company?position=1", '#page_content','init()');	
		}
		);
						
		$("#assets_decending").click(function()
		{
			return aj( current_page() + "/element/company?position=0", '#page_content','init()');	
		}
		);

		$("#company_decending").click(function()
		{
			return aj( current_page() + "/element/company?companyname=0", '#page_content','init()');	
		}
		);		

		$("#company_assending").click(function()
		{
			return aj( current_page() + "/element/company?companyname=1", '#page_content','init()');	
		}
		);				

		$("#location_decending").click(function()
		{
			return aj( current_page() + "/element/company?location=0", '#page_content','init()');	
		}
		);		

		$("#location_assending").click(function()
		{
			return aj( current_page() + "/element/company?location=1", '#page_content','init()');	
		}
		);				

		$("#sector_decending").click(function()
		{
			return aj( current_page() + "/element/company?sector=0", '#page_content','init()');	
		}
		);		

		$("#sector_assending").click(function()
		{
			return aj( current_page() + "/element/company?sector=1", '#page_content','init()');	
		}
		);		
		
		/*
		$("#assets_assending").click(function()
		{
			return aj( current_page() + "element/company?assets=1", '#page_content','init()');
			
		}
		);
						
		$("#assets_decending").click(function()
		{
			return aj( current_page() + "element/company?assets=0", '#page_content','init()');	
		}
		);
		*/
		
		$("#allcompany_decending").click(function()
		{
			return aj( current_page() + "/element/allcompanies?companyname=0", '#page_content','init()');	
		}
		);		

		$("#allcompany_assending").click(function()
		{
			return aj( current_page() + "/element/allcompanies?companyname=1", '#page_content','init()');	
		}
		);				

		$("#alllocation_decending").click(function()
		{
			return aj( current_page() + "/element/allcompanies?location=0", '#page_content','init()');	
		}
		);		

		$("#alllocation_assending").click(function()
		{
			return aj( current_page() + "/element/allcompanies?location=1", '#page_content','init()');	
		}
		);				

		$("#allsector_decending").click(function()
		{
			return aj( current_page() + "/element/allcompanies?sector=0", '#page_content','init()');	
		}
		);		

		$("#allsector_assending").click(function()
		{
			return aj( current_page() + "/element/allcompanies?sector=1", '#page_content','init()');	
		}
		);			
		
		// hwf stuff
		
		
		$("#hwfcompany_decending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?companyname=0", '#page_content','init()');	
		}
		);		

		$("#hwfcompany_assending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?companyname=1", '#page_content','init()');	
		}
		);				

		$("#hwflocation_decending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?location=0", '#page_content','init()');	
		}
		);		

		$("#hwflocation_assending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?location=1", '#page_content','init()');	
		}
		);				

		$("#hwfsector_decending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?sector=0", '#page_content','init()');	
		}
		);		

		$("#hwfsector_assending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?sector=1", '#page_content','init()');	
		}
		);			
		
		$("#hwfassets_assending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?assets=1", '#page_content','init()');
			
		}
		);
						
		$("#hwfassets_decending").click(function()
		{
			return aj( current_page() + "/element/hwfcompanies?assets=0", '#page_content','init()');	
		}
		);
		
	}

	function current_page()
	{
	var page_location_array = window.location.href.split('?');
	
	return page_location_array[0];
	}


	function aj(url,container,js_function) {     
	
	var containers = container.split("/");        
	$(".ajax_loader").show();  
	
	try{        
		$.post( url , '' , function( data ){                        
			var json = data;                        
			
			for( var i = 0 ; i < json.response.length; i++ )            
			{                               
				switch( json.response[i].type )                
				{                    
					case 'HTML':                        
						$( containers[i] ).html( json.response[i].data );                           
			 			break;                  
	   				case 'SUCCESS':                       
  						success( json.response[i].data );                        
  						break;                    
					case 'WARNING':                        
						warn( json.response[i].data );          
						break;                
				    case 'JSCRIPT':       
					    eval( json.response[i].data );       
						break;                
				}                            
			}                        
			
			if( js_function != null )
			{
				eval(js_function);
			}
			$('.ajax_loader').hide();                    
		},'json');
	}
	catch(e)
	{
		warn(e);        
		$('.ajax_loader').hide();    
	}        
	
	return false;   
	}





	
	$(document).ready(function()
	{
		
		$('a').click( function(){
			var linkHref = $(this).attr('href');
			var linkArray = linkHref.split('/');
			var locationHref = window.location.href;
			var locationArray = locationHref.split('/');
			
			if(locationArray[2] != linkArray[2] && linkArray[0] == 'http:' ){
				var reply = confirm('You are now leaving the HIML website, which is regulated by the FSA.  HIML does not sponsor, maintain or have any control over the content of the following website. Therefore, HIML is not responsible for the adequacy or accuracy of any of the information you are about to review on the website you are about to enter.');
				if( !reply ) return false;
			}
			
				
		} );
		
		$(function(){
			$("#finance-download").hide();
			$("#financearchive").hide();
			
			$("#finance-download").click(function(){
				if ($("#financearchive").val() != '') {
					window.open ($("#financearchive").val(),"Download"); 
					// window.location = '/docs/' + $("#financearchive").val();
				}
			});
			
			$("#financearchive-type").change(function() {
				var catId = $("#financearchive-type").val();
				$("#financearchive").html( $('#' + catId).html() );
				$("#financearchive").fadeIn();
			});
			
			$("#financearchive").change(function() {
				if ($("#financearchive").val() != '') {
					$("#finance-download").fadeIn();
				}else{
					$("#finance-download").hide();
				}
			});
		}); 

		$(function()
		{
		$('#panel').jScrollPane({scrollbarWidth:5});	
		});


		var api = $("#modal").overlay({oneInstance: false, api: true,     expose: { 
	        color: '#333', 
	        loadSpeed: 200, 
	        opacity: 0.7 
	    }, closeOnClick: false });
	

		if (mycookie("agreed") != 1)
		{
		api.load();
		}
			

		$('#accept_popup').click(function() {
			mycookie("agreed", "1");
			  api.close();
		});

		$('#decline_popup').click(function() {
			window.location= "http://www.google.com" 
		});				
		
		init();
		
		
	});
	
	
