function embedObject(flash_file, width, height) {
	document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"'+width+'\" height=\"'+height+'\">' +
	'    <param name=\"movie\" value=\"'+flash_file+'\" />' +
	'    <param name=\"quality\" value=\"high\" />' +
	'	 <param name=\"wmode\" value=\"transparent\" />' +
	'    <embed src=\"'+flash_file+'\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"'+width+'\" height=\"'+height+'\"></embed>' +
	'  </object>');
}

var message = "Print this Page";
function printpage(o){
    alert("Please set your printer orientation to " + o +" and your paper size to A4")
    window.print()
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

// Clear the default values in a form field
function clear_default(field, initial){
	if($("#"+field).val() == initial){
		$("#"+field).val('')
	}
	else if($("#"+field).val() == ''){
		$("#"+field).val(initial)
	}
}

function clear_default_2(field, initial){
    
    $(field).removeClass('error');
    
	if($(field).val() == initial){
		$(field).val('')
	} else if($(field).val() == ''){
		$(field).val(initial)
	} else if(errors[field.name] && formdata[field.name]){
		
        if (errors[field.name]==formdata[field.name] || formdata[field.name]==initial) {
           $(field).val('');
        } else {
           $(field).val(formdata[field.name])
        }
        errors[field.name] = "";
	} 
}

var timerID = null 
var timerRunning = false 

function stopclock(){ 
    if(timerRunning) 
        clearTimeout(timerID) 
    timerRunning = false 
} 

function startclock(){ 
    stopclock() 
    showtime() 
}

function showtime(){ 
    var now = new Date() 
    var hours = now.getHours() 
    var minutes = now.getMinutes() 
    var seconds = now.getSeconds() 
    var timeValue = hours 
    timeValue  += ((minutes < 10) ? ":0" : ":") + minutes 
    timeValue  += ((seconds < 10) ? ":0" : ":") + seconds 
    document.getElementById('clock').firstChild.nodeValue = timeValue 
    timerID = setTimeout("showtime()",1000) 
    timerRunning = true 
}


function validate(){
    if($('#name').val() == '' || $('#name').val() == 'Contact Name'){
        alert('Please enter your name.')
    }
    else if($('#number').val() == '' || $('#number').val() == 'Contact Number'){
        alert('Please enter your contact number.')
	}
	else if($('#email').val() == '' || $('#email').val() == 'Email Address'){
        alert('Please enter your email.')
    }
	else if($('#comments').val() == '' || $('#comments').val() == 'Comments / Enquiry'){
        alert('Please enter your comments.')
    }
    else{
        $('#id_contact').submit()
    }
}

function displaybranch(branchname){

	var stores=["headoffice","clearwater","zoo","origins","retail","glen"];
	branchname = branchname + ''
	for (i=0; i<=stores.length; i++){
		
		if (branchname == stores[i]){
			$('#' + stores[i]).show()
		}
		else {
			$('#'+ stores[i]).hide()
		}
	}
}

