/*

haiku-js-v0005.js
combined js for haikudesigns.com


*/


/* HAIKU LEGACY FUNCTIONS */

function showPic(nColor)	{
	var s = (nColor==1) ? imgNatural : imgBlack;
	setPic(s,nColor);
}

function setPic(source,nSel)	{
	if (source)	{
		document['pic'].src=source;
	}
	if (document.form1)	{
		if (document.form1.op1)	{
			if (document.form1.op1.length>1)
				document.form1.op1.selectedIndex = nSel;
		}
	}
	if (document.form2)	{
		if (document.form2.op1)	{
			if (document.form2.op1.length>1)
				document.form2.op1.selectedIndex = nSel;
		}
	}
	picColor=nSel;
}

function showPic2(nSel,formname,picname,images)	{
	var s = images[nSel];
	if (s)	{
		document[picname].src=s;
	}
	if (document.forms[formname])	{
		if (document.forms[formname].op1)	{
			if (document.forms[formname].op1.length>1)
				document.forms[formname].op1.selectedIndex = nSel;
		}
	}
	picColor=nSel;
}

function showLargeImage(source)	{
	var s;
	s = "largeimg.htm?src="+escape(source);
	showWindow(s);	
	return false;
}

function showLargeImage2(source0,source1)	{
	var s;
	var source = (picColor==0) ? source0 : source1;
	s = "largeimg.htm?src="+escape(source);
	showWindow(s);	
	return false;
}

function showInfo(thePage)	{
	var newWin = window.open(thePage,"newWin","resizable=yes,menubar=no,titlebar=yes,dependent=yes,width=470,height=540");
	newWin.focus();
	return false;
}

function showWindowXY( thePage, width, height)	{
	var newWin = window.open(thePage,"newWin","resizable=yes,scrollbars=yes,menubar=no,titlebar=yes,dependent=yes,width="+width+",height="+height);
	newWin.focus();
	return false;
}

function showWindow(thePage)	{
	var newWin = window.open(thePage,"newWin","resizable=yes,menubar=no,titlebar=yes,dependent=yes,width=350,height=450");
	newWin.focus();
	return false;
}

function WriteEmail( t )	{
	document.writeln('<a href="mailto:'+'information'+'@'+'haikudesigns.com">'+t+'</a>');
}

/* END   HAIKU LEGACY FUNCTIONS */









/* DOCUMENT FEATURES STARTUP SUPPORT 
*/

$(document).ready(function() {

	// colorbox
	$("a.lightbox,a.lightbox-simple").colorbox();
/*
//	$("a.lightbox-div").colorbox( { width: "50%", inline: true, href: '#test1' } );
	$("a.lightbox-div").colorbox( { width: "50%", inline: true, href: function() {
		// notyet - see if visible, if not show, then restore afterwards (need event)
		$($(this).attr('href')).show(); // works
		return $(this).attr('href');
//		return '#test1';
		}});
*/
	
	/* ORDER TABS */
	if ( $(".order-tabs").length) {
		$(".order-tabs").tabs("> .order-pane");
	}

	
	/* PAGE/PRODUCT NAVIGATION */
	if ( $('ul.pagenav') ) {
		// attach hover function to pagenav elements
		// image div must be right after anchor
		$('ul.pagenav a').each( function( i ) {
			$(this).hover( function() {
				$(this).next().show();
			}, function() {
				$(this).next().hide();
			});
		});	
	}

	//NOTYET - BTR - NOT WORKING WITH JQUERY 1.4.4
	//$("a[@rel$='external']").click(function(){
	//	this.target = "_blank";
	//});	

	
	
});


/* END DOCUMENT FEATURES */


