// JavaScript Document

function check_search()
{
	var searchval = document.getElementById("query").value;
	
	if(searchval == "")
	{
		alert("Please enter a keyword to search");
	//	return false;
	}
	else{
		document.searchform.submit();
	//	return true;	
	}
}

function load_shadowbox()
{
  Shadowbox.init();
}

function handle_submit(mode,state)
{
	document.map_search.mode.value = mode;
	document.map_search.map_state.value = state;	
	document.map_search.submit();
}

function load_store_maps()
{
	MM_preloadImages('store/map/main.gif','store/map/Vic_h.gif','store/map/ACT_h.gif','store/map/SA_h.gif','store/map/Vic_h.gif','store/map/NT_h.gif','store/map/WA_h.gif','store/map/NSW_h.gif','store/map/QL_h.gif','store/map/TAS_h.gif');	
}

function highlightState(stateName)
{
	switch(stateName)
	{
		case 'VIC':
				MM_swapImage('ausmap','','store/map/Vic_h.gif',1);
				break;
		case 'ACT':
				MM_swapImage('ausmap','','store/map/ACT_h.gif',1);				
		break;
		case 'SA':
				MM_swapImage('ausmap','','store/map/SA_h.gif',1);
				
				break;
		case 'NT':
				MM_swapImage('ausmap','','store/map/NT_h.gif',1);
				break;
		case 'WA':
				MM_swapImage('ausmap','','store/map/WA_h.gif',1);
				break;
		case 'NSW':
				MM_swapImage('ausmap','','store/map/NSW_h.gif',1);
				break;	
		case 'QLD':
				MM_swapImage('ausmap','','store/map/QL_h.gif',1);
				break;	
		case 'TAS':
				MM_swapImage('ausmap','','store/map/TAS_h.gif',1);
				break;
		default:
			MM_swapImage('ausmap','','store/map/main.gif',1);
				break;
		break		
	}
	
}

function show_form(prod_id,cate_ids)
{
	if(prod_id!= "" && cate_ids != "")	
		window.open('email_to_friend.php?mode=show_form&prod_id='+prod_id+'&cat_id_pipe='+cate_ids,'','location=0,status=0,scrollbars=1,width=900,height=600')
	else if(prod_id!= "")	
	window.open('email_to_friend.php?mode=show_form&prod_id='+prod_id+'&cat_id_pipe='+cate_ids,'','location=0,status=0,scrollbars=1,width=900,height=600')
}


function load_home_banner()
{
 var so = new SWFObject("flash/banner.swf", "company_flash", "765", "250", "6", "");
 so.addParam("wmode", "transparent");
 so.write("company_flash");

}
function load_sub_banner()
{
 var so = new SWFObject("flash/sub_banner.swf", "company_flash", "765", "130", "6", "");
 so.addParam("wmode", "transparent");
 so.write("company_flash");

}

//Set the contact us form value 
//And submit the product details enquire form to contact us form
function prod_contact_form()
{
	document.contact_form.submit();		
}

function show_disclaimer(file_path)
{	
	alert('Specifications are to be used as a reference only. Swan reserves the right to vary specifications or delete models from their range without prior notification.');
	window.open(file_path);
}


function show_form_search(prod_id,query)
{
	if(prod_id!= "")	
	{
		window.open('email_to_friend.php?mode=show_form&prod_id='+prod_id+'&search_pro='+1+'&query='+query,'','location=0,status=0,scrollbars=1,width=900,height=600');
	}
}