function tellafriend()
{
	window.open("/tellafriend.php", "tellafriend", "width=400,height=200,scrollbar=no,statusbar=no");
}

function make_drag(obj)
{
	$(obj).makeDraggable({handle:$('handle'),onStart:function(){$(obj).setOpacity(0.7)},onComplete:function(){$(obj).setOpacity(1)}});
}

function showform(btnobj)
{
	var input_form = '';
	var obj = $('qform');




	obj.style.display = '';
	obj.style.left =  (window.getScrollLeft()+(window.getWidth()-390)/2) + 'px';
	obj.style.top = (window.getScrollTop()+(window.getHeight()-350)/2) +'px';

	$('curtain').setStyle('width', window.getScrollWidth() + 'px')
	$('curtain').setStyle('height', window.getScrollHeight() + 'px');
	$('curtain').setOpacity(0);
	$('curtain').style.display = '';

	// fade in curtain
	new Fx.Style('curtain', 'opacity', {duration:500}).start(0,0.8);
	//$('curtain').setOpacity(0.8);


}

function form_cancel()
{
	$('qform').style.display='none';
	$('curtain').style.display='none';
}
function _rollover(obj,r) { _assign(obj,obj.src,r); } function _assign(obj,s,r) { obj.onmouseover = function() { obj.src = r; }; obj.onmouseout = function() { obj.src = s; }; obj.border=0; obj.onload=''; }

function check_form(formobj)
{
	if (isNaN(parseInt(formobj.q.value)) || parseInt(formobj.q.value) != formobj.q.value)
	{
	    alert("Please enter a valid QTY");
	    formobj.q.value = 1;
	    formobj.q.focus();
	    return false;
	}
	


	return true;
}
/*
var _timeout = new Array();

function start_scroll(step,div)
{
	document.getElementById(div).scrollTop+=step;
	// accelerate the scroll speed as we keep scrolling
	if (step>0)
		step++;
	else
		step--;

	_timeout[div] = setTimeout('start_scroll('+step+',"'+div+'")', 50);

	var sz = $(div).getSize();

	if (sz.scroll.y == 0)
		$(div+'_up').setOpacity(0.1);
	else
		$(div+'_up').setOpacity(1);

	if (sz.scrollSize.y-sz.scroll.y <= sz.size.y)
		$(div+'_dn').setOpacity(0.1);
	else
		$(div+'_dn').setOpacity(1);
}

function stop_scroll(div)
{
	if (_timeout[div]) clearTimeout(_timeout[div]);
	_timeout[div] =false;
	
}

function check_downarrow(div)
{
	var sz = $(div).getSize();

	if (sz.scrollSize.y <= sz.size.y)
	{
		$(div+'_up').setOpacity(0.1);
		$(div+'_dn').setOpacity(0.1);
	}
	else
	{
		$(div+'_up').setOpacity(0.1);
		$(div+'_dn').setOpacity(1);
	}
}

function scroll(n,div)
{
	vrooom(n,div);
}
*/
// scrolling of latest product
// do scroll animations
/*
var s1;
var s2;
var st;
var STEP = 3;
var DELAY = 50;

function anim_s1()
{
	s1.style.left = (s1.offsetLeft-STEP) + 'px';
	if (s1.offsetLeft+s1.clientWidth<0)
	{
		init_s1();
		anim_s2();
		return;
	}
	else if (s1.offsetLeft+s1.clientWidth<550)
	{
		s2.style.left = (s1.offsetLeft+s1.clientWidth)+ 'px';
	}
	setTimeout("anim_s1()", DELAY);
}

function anim_s2()
{
	s2.style.left = (s2.offsetLeft-STEP)+ 'px';;
	if (s2.offsetLeft+s2.clientWidth<0)
	{
		init_s2();
		anim_s1();
		return;
	}
	else if (s2.offsetLeft+s2.clientWidth<550)
	{
		s1.style.left = (s2.offsetLeft+s2.clientWidth)+ 'px';;
	}
	setTimeout("anim_s2()", DELAY);
}

function init_s1(x)
{
	if(x!=undefined)
	    s1.style.left = 0;
	else
		s1.style.left = '600px';
	s1.style.display='';
}
function init_s2()
{
	s2.style.left = '600px';
	s2.style.display='';
}

function home_init_scroller()
{
	s1 = $('scroll_1');
	s2 = $('scroll_2');
	st = $('ct');
	init_s1(1);
	init_s2();
	anim_s1();
}
var slide_n = 0;
var fx1;
function change_slide()
{
    slide_n++;
    if (slide_n==12) slide_n=1;
	$('slideshowbg').style.background = 'url("'+slideshows[slide_n].img+'") 32px 24px no-repeat';
	$('slideshowframe').innerHTML = slideshows[slide_n].title;
	$('slideshowframe').onclick = function() { document.location = '/get_product.php?a=t&id='+slideshows[slide_n].id; }
	fx2.start(0,1);
}

function home_init_scroller()
{
	var str = $('contentscroll').innerHTML;
	str = '<div id=slideshow><div id=slideshowbg></div><div id=slideshowframe></div></div>' + str;
	$('contentscroll').innerHTML = str;
	
	fx1 = new Fx.Style('slideshowbg','opacity',{duration:200, onComplete:change_slide});
	fx2 = new Fx.Style('slideshowbg','opacity',{duration:200, onComplete:function() { setTimeout('fx1.start(1,0)',2000)}});
	change_slide();
}
*/
// taken from http://bugs.digitalg.net/inc/nav_main.js
// detecting scrollwheeel (cool!)
/*if(document.attachEvent)
	document.attachEvent("onmousewheel",scrollWheelMove);
else
	window.addEventListener("DOMMouseScroll", scrollWheelMove, false);

function scrollWheelMove (e) {
if (window.event || window.Event) {
	if (!e) e = window.event;
	}
}
*/
//-------------------
// init
/*window.onload =  function()
{
	$('container_up').onmousedown = function() { start_scroll(-5,'container'); }
	$('container_up').onmouseup = function() { stop_scroll('container'); }
	
	$('container_dn').onmousedown = function() { start_scroll(5,'container'); }
	$('container_dn').onmouseup = function() { stop_scroll('container'); }

	$('contentscroll_up').onmousedown = function() { start_scroll(-50,'contentscroll'); }
	$('contentscroll_up').onmouseup = function() { stop_scroll('contentscroll'); }
	
	$('contentscroll_dn').onmousedown = function() { start_scroll(50,'contentscroll'); }
	$('contentscroll_dn').onmouseup = function() { stop_scroll('contentscroll'); }

	check_downarrow('container');
	check_downarrow('contentscroll');
}
*/
