/*
Built by Stephen Tucker [contact@stevetucker.co.uk]
Copyright (c) 2006 Stephen Tucker [contact@stevetucker.co.uk]
----------------------------------------------------------------
This script and all others packaged with it belong to Stephen Tucker.
Unless otherwise stated in the file copying, editing and/or redistributing
of all scripts/files in any way is strictly prohibited. All scripts/files were
designed and developed by Stephen Tucker [contact@stevetucker.co.uk].
Please contact Stephen Tucker [contact@stevetucker.co.uk] for more information.
Full terms and conditions apply.
*/

function popup($URL) {
	var $day = new Date();
	var $id = $day.getTime();
	eval("page" + $id + " = window.open('" + $URL + "', '" + $id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=650,left = 212,top = 59');");
}


function copyDeliveryToBilling() {
	document.getElementById('billing_first_name').value	= document.getElementById('delivery_first_name').value;
	document.getElementById('billing_last_name').value	= document.getElementById('delivery_last_name').value;
	document.getElementById('billing_address1').value	= document.getElementById('delivery_address1').value;
	document.getElementById('billing_address2').value	= document.getElementById('delivery_address2').value;
	document.getElementById('billing_address3').value	= document.getElementById('delivery_address3').value;
	document.getElementById('billing_address4').value	= document.getElementById('delivery_address4').value;
	document.getElementById('billing_postcode').value	= document.getElementById('delivery_postcode').value;
	if (document.getElementById('billing_address5')) {
		document.getElementById('billing_address5').value = document.getElementById('delivery_address5').value;
	}
}


function display_enlarge_notice($element) {
	if (!document.getElementById) return false;
	if (document.getElementById('enlarge_notice')) {
		hide_enlarge_notice();
	}
	var $p = document.createElement('p');
	$p.setAttribute('id','enlarge_notice');
	var $text = document.createTextNode('Click to Enlarge');
	$p.appendChild($text);
	
	var $img = $element.childNodes[0];
	$img.style.border = '1px solid #6351A2';
	$element.insertBefore($p,$img);
}


function hide_enlarge_notice() {
	if (!document.getElementById) return false;
	if (document.getElementById('enlarge_notice')) {
		var $p = document.getElementById('enlarge_notice');
		var $parent_node = $p.parentNode;
		removeNode($p);
		var $img = $parent_node.childNodes[0];
		$img.style.border = '1px solid #FFFFFF';
	}
	return false;
}

function move_information_text() {
	if (!document.getElementById('information')) return false;
	var $information = document.getElementById('information');
	var $parent = $information.parentNode;
	$parent.removeChild($information);
	var $page_bottom = document.getElementById('page_bottom')
	$page_bottom.appendChild($information);
	$information.style.display = 'block';
}

addLoadEvent(move_information_text);

if (document.getElementById) {
	var $link = document.createElement('link');
	$link.setAttribute('href','css/javascript_only.css');
	$link.setAttribute('rel','stylesheet');
	$link.setAttribute('id','temp_stylesheet');
	$link.setAttribute('media','screen');
	var $head = document.getElementsByTagName('head')[0];
	$head.appendChild($link);
}

function load() {
	if(!document.getElementById('map')) return false;
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        var gardenPoint = new GLatLng(53.379169, -1.477554, 10);
	map.setCenter(gardenPoint, 14)
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	var gardenMarker = new GMarker(gardenPoint);
	map.addOverlay(gardenMarker);
	var gardenHtml = '<strong>avorio studio 0.1</strong><br /><a href="http://www.google.com/maps?f=d&saddr=huddersfield&daddr=The+Plaza,+Unit+6,+8+Fitzwilliam+St,+Sheffield,+South+Yorkshire,+S1+4JB,+United+Kingdom+(Avorio)&hl=en&geocode=%3BCQgDW_Ndlc72FXuCLgMdM2np_yG2RQbvznSypA&mra=pe&mrcr=0&sll=53.558192,-1.689871&sspn=0.579989,1.987152&ie=UTF8&t=h&z=10" target="_blank">Get Directions</a>';
      	gardenMarker.openInfoWindowHtml(gardenHtml);
      }
    }
addLoadEvent(load);