function disImg(id)
{
	document.getElementById('id_img_front').style.display = 'none';
	document.getElementById('id_img_back').style.display = 'none';
	document.getElementById('id_img_side').style.display = 'none';
	document.getElementById('id_img_interior').style.display = 'none';
	
	if(id == 1) document.getElementById('id_img_front').style.display = 'block';
	else if(id == 2) document.getElementById('id_img_back').style.display = 'block';
	else if(id == 3) document.getElementById('id_img_side').style.display = 'block';
	else if(id == 4) document.getElementById('id_img_interior').style.display = 'block';
}
function showMsg(id)
{
	if(id != '')
	{
		document.getElementById('msg_'+id).style.display = 'block';
	}
	// What is $(document).ready ? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
	$(document).ready(function() {
	// select the overlay element - and "make it an overlay"
	$("#divMsg").overlay({
	 
		// custom top position
		top: 260,
	 
		// some mask tweaks suitable for facebox-looking dialogs
		mask: {
	 
			// you might also consider a "transparent" color for the mask
			color: '#000',
	 
			// load mask a little faster
			loadSpeed: 200,
	 
			// very transparent
			opacity: 0.5
		},
		// disable this for modal dialog-type of overlays
		closeOnClick: false,
	 
		// load it immediately after the construction
		load: true
	 
	});
	});
}
function toggle(id){
	var target1 = document.getElementById(id)
	if (target1.style.display == 'none') {
	target1.style.display = 'block'
	} else {
	target1.style.display = 'none'
	}
} 
function carHunter(id)
{
	var enq_id = document.form_misc.enq_id.value;
	var new_used = document.getElementById('id_new_used').value;
	var make = document.getElementById('id_make').value;
	var model = document.getElementById('id_model').value;
	var rbkey = document.getElementById('id_rbkey').value;
	if(id == 2)
	{
		window.location='../car_hunter.php?cb=1&enq_id='+enq_id+'&new='+new_used+'&make='+make+'&model='+model+'&rbkey='+rbkey;//from landing pages
	}
	else window.location='car_hunter.php?cb=1&enq_id='+enq_id+'&new='+new_used+'&make='+make+'&model='+model+'&rbkey='+rbkey;
}
function AllowOnlyNumeric()
{
    // Get the ASCII value of the key that the user entered
    var key = window.event.keyCode;

    // Verify if the key entered was a numeric character (0-9) or a decimal (.) or space
    if ( (key > 47 && key < 58) || key == 46 || key == 47 || key == 37 || key == 32)
        // If it was, then allow the entry to continue
        return;
    else
        // If it was not, then dispose the key and continue with entry
        window.event.returnValue = null;
}

function chk_email(str)
{

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	   return false;
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	   return false;
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		return false;
	if (str.indexOf(at,(lat+1))!=-1)
		return false;
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		return false;
	if (str.indexOf(dot,(lat+2))==-1)
		return false;
	if (str.indexOf(" ")!=-1)
		return false;
	return true;			
}
function cusToggle(id)
{
	if(id == 1)
	{
		document.getElementById('form_1').style.display = 'block';	
		document.getElementById('form_2').style.display = 'none';	
	}
	else if(id == 2)
	{
		document.getElementById('form_1').style.display = 'none';	
		document.getElementById('form_2').style.display = 'block';		
	}
	else if(id == 3)
	{
		document.getElementById('form_1').style.display = 'none';	
		document.getElementById('form_2').style.display = 'none';	
	}
}
function closeDiv(id)
{
	document.getElementById(id).style.display = 'none';	
}
function hideMsg(id) {document.getElementById(id).style.display='none';}
