    if (document.images){
		preload = new Image();
		image_url = new Array();
		image_url[0] = "http://d.neadiamonds.com/images/menu-title-1-over.jpg";
		image_url[1] = "http://d.neadiamonds.com/images/menu-title-2-over.jpg";
		image_url[2] = "http://d.neadiamonds.com/images/menu-title-3-over.jpg";
		image_url[3] = "http://d.neadiamonds.com/images/menu-title-4-over.jpg";
		var i = 0;
		for(i=0; i<=3; i++){ 
			preload.src = image_url[i];
		}
	}
	var timer = new Array();
	timer[1] = 0;
	timer[2] = 0;
	timer[3] = 0;
	timer[4] = 0;
	timer['ft1'] = 0;
	timer['ft2'] = 0;
	timer['ft3'] = 0;
	timer['ft4'] = 0;
	var is_open = new Array();
	is_open[1] = false;
	is_open[2] = false;
	is_open[3] = false;
	is_open[4] = false;
	is_open['ft1'] = false;
	is_open['ft2'] = false;
	is_open['ft3'] = false;
	is_open['ft4'] = false;
	function menu_open( id ){

		clearTimeout ( timer[id] );
		element = $('menu-items-' + id).cleanWhitespace();
		
		if( is_open[id] == false ){
			if( document.getElementById('menu-img-' + id) ){
				document.getElementById('menu-img-' + id).src = '/images/menu-title-'+id+'-over.jpg';
			}
			Effect.SlideDown( 'menu-items-' + id, {duration: 0.3, queue: {position: 'end', scope: 'menu-' + id, limit: 2} });
			is_open[id] = true;
		}
	}
	function menu_close( id, timeout ){
		timeout = typeof(timeout) != 'undefined' ? timeout : 750;
		element = $('menu-items-' + id).cleanWhitespace();
		if( element.getStyle('bottom') != '0px' ){
			timer[id] = setTimeout ( "menu_shut('"+id+"')", timeout );
		}
	}
	function menu_shut( id ){
		element = $('menu-items-' + id).cleanWhitespace();
		if( element.getStyle('bottom') != '0px' ){
			Effect.SlideUp( 'menu-items-' + id, {delay: 0, duration: 0.2, queue: {position: 'end', scope: 'menu-' + id, limit: 2} });
			if( document.getElementById('menu-img-' + id) ){
				if( id==area ){
					var shut = '/images/menu-title-'+id+'-in.jpg';
				}else{
					var shut = '/images/menu-title-'+id+'.jpg';
				}
				document.getElementById('menu-img-' + id).src = shut;
			}
			is_open[id] = false;
		}
	}

function tL(){
	var links = document.getElementsByTagName('a');	
	var link_count = links.length;
	for (var i = 0; i < link_count; i++){
		Event.observe(links[i], 'click', tC);
	}
}
function tC(e){
	var link_name = escape(this.id);
	var page_name = encodeURIComponent(window.location.pathname);
	if (page_name == undefined || page_name == ''){
		return true;
	}
	if (document.images){
		(new Image()).src = '/click.php?p=' + page_name + '&l=' + link_name;
	}
	
	return true;
}
function email_friend(){
	var error = 0;
	var em = /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
	var tmp = $('my-email').value;

	if( em.test($('my-email').value) == false ){
		error = 1;
		new Effect.Highlight('my-email', {startcolor:'#ff3333', endcolor:'#ffb0b0',restorecolor:'#ffb0b0'} );
	}else{
		$('my-email').setStyle({backgroundColor: '#ffffff'})
	}
	if( em.test($('to-email').value) == false ){
		error = 1;
		new Effect.Highlight('to-email', {startcolor:'#ff3333', endcolor:'#ffb0b0',restorecolor:'#ffb0b0'} );
	}else{
		$('to-email').setStyle({backgroundColor: '#ffffff'})
	}
	if( error < 1 ){
		new Ajax.Request('/ajax.php?load=email_friend',{ parameters: Form.serialize('email_form'),
			onSuccess: function(response) {
				//success, do not follow form action
				return false;
			}, onFailure: function(response) {
				//failure, follow the form action
				return true;
			}
		});
	}
	return false;
}
function email_us(){
	new Ajax.Request('/ajax.php?load=email_us',{ parameters: Form.serialize('contact_form'),
		onSuccess: function(response) {
			//success, do not follow form action
			return false;
		}, onFailure: function(response) {
			//failure, follow the form action
			return true;
		}
	});
	return false;
}
function more_images( mid, enlarge ){
	document.getElementById('product_img').src = mid;
	document.getElementById('product_img_a').href = enlarge;
}

var D = Class.create({
	view:function( model ){
		//change the cursor to a waiting state
		document.body.style.cursor='wait';
		a = document.getElementsByClassName('pb-link');
		for (var i=0;i < a.length; i++){
			a[i].style.cursor='wait';
		}
		new Ajax.Request('/ajax.php?load=product&model='+encodeURIComponent(model),{
			onSuccess: function(response) {
				//success, javascript will change the page.  Do not follow href in original link
				document.body.style.cursor='';
				a = document.getElementsByClassName('pb-link');
				for (var i=0;i < a.length; i++){
					a[i].style.cursor='';
				}
				D.closeBoxes();
				return false;
			}, onFailure: function(response) {
				//failure, follow the href in the original link
				return true;
			}
		});
	},
	openMore:function(box){
		Element.hide('share_box');
		Element.hide('share_email');
		Element.hide('share_contact');
		Element.hide('share_link');
		Element.hide('more_details');
		Element.hide('brand_details');
		Effect.SlideDown(box,{duration:0.3});
	},
	closeMore:function(box){
		Effect.SlideUp(box,{duration:0.3});
		setTimeout("D.closeBoxes();",300);
	},
	closeBoxes:function(){
		Element.hide('designer_splash');
		Element.hide('share_box');
		Element.hide('share_email');
		Element.hide('share_contact');
		Element.hide('share_link');	
		Element.hide('more_details');
		Element.hide('brand_details');
		Element.update('email_status','');
		Element.update('contact_status','');
	}
});
var D = new D();
