function swapView( viewID )
{
	for ( i = 1; i < 7; i++ )
	{
		if ( document.getElementById('sdri_view' + i ) )
		{
			document.getElementById('sdri_view' + i ).style.display = 'none';
		}
	}
	
	document.getElementById(viewID).style.display="block";
}

contentWin = null;
descWin = null;
techWin = null;
colorWin =null;
careWin =null;
fitWin =null;
function showExpandedView()
{
	if (contentWin != null)
	{
		Dialog.alert("Close the expanded view before opening it again!",{width:200, height:130});
	}
	else
	{
		/* Create my window                    */ contentWin = new Window({className: "alphacube", title: "<b id='drag'>[ Click to drag window ]</b> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>Larger Shoe Image</b> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b id='drag'>[ Click to drag window ]</b>", maximizable: false, minimizable: false, resizable: false, hideEffect:Effect.Fade, showEffect:Effect.Appear, minWidth: 10, destroyOnClose: true, top: 200, left: 50 })
		/* Set the content to SPARTAAAAAAA!!!! */ contentWin.setContent('sdri_largeview', true, false);
		/* Constrain to window                 */ contentWin.setConstraint(true, {left:10, right:20, top: 135, bottom: 10})
		/* Show the window                     */ contentWin.show();
		
		// Set up a windows observer, check out debug window to get messages
		
		myObserver =
		{
			onDestroy: function(eventName, win)
			{
				if (win == contentWin)
				{
					document.getElementById('sdri_largecontainer').appendChild($('sdri_largeview'));
					contentWin = null;
					Windows.removeObserver(this);
				}
				debug(eventName + " on " + win.getId())
			}
		}
		Windows.addObserver(myObserver);
	}
}

function showLongDescription()
{
	if (descWin != null)
	{
		Dialog.alert("Close the long description before opening it again!",{width:200, height:130});
	}
	else
	{
		/* Create my window                    */ descWin = new Window({className: "alphacube", title: "<b id='drag'>[ Click to drag window ]</b> &nbsp; &nbsp;<b>About This Shoe</b> &nbsp; &nbsp;<b id='drag'>[ Click to drag window ]</b>", maximizable: false, minimizable: false, resizable: false, hideEffect:Effect.Fade, showEffect:Effect.Appear, minWidth: 10, destroyOnClose: true, top: 200, left: 200 })
		/* Set the content to SPARTAAAAAAA!!!! */ descWin.setContent('sdri_longdesc', true, false);
		/* Constrain to window                 */ descWin.setConstraint(true, {left:10, right:20, top: 135, bottom: 10})
		/* Show the window                     */ descWin.show();
		
		// Set up a windows observer, check out debug window to get messages
		
		myObserver =
		{
			onDestroy: function(eventName, win)
			{
				if (win == descWin)
				{
					document.getElementById('sdri_descwrapper').appendChild($('sdri_longdesc'));
					descWin = null;
					Windows.removeObserver(this);
				}
				debug(eventName + " on " + win.getId())
			}
		}
		Windows.addObserver(myObserver);
	}
}












function showTechFeatures()
{
	if (techWin != null)
	{
		Dialog.alert("Close Tech Features before opening it again!",{width:200, height:130});
	}
	else
	{
		/* Create my window                    */ techWin = new Window({className: "alphacube", title: "<b id='drag'>[ Click to drag window ]</b> &nbsp; &nbsp;<b>Technical Features</b> &nbsp; &nbsp;<b id='drag'>[ Click to drag window ]</b>", maximizable: false, minimizable: false, resizable: false, hideEffect:Effect.Fade, showEffect:Effect.Appear, minWidth: 10, destroyOnClose: true, top: 200, left: 200 })
		/* Set the content to SPARTAAAAAAA!!!! */ techWin.setContent('sdri_techcontent', true, false);
		/* Constrain to window                 */ techWin.setConstraint(true, {left:10, right:20, top: 135, bottom: 10})
		/* Show the window                     */ techWin.show();
		
		// Set up a windows observer, check out debug window to get messages
		
		myObserver =
		{
			onDestroy: function(eventName, win)
			{
				if (win == techWin)
				{
					document.getElementById('sdri_techwrapper').appendChild($('sdri_techcontent'));
					techWin = null;
					Windows.removeObserver(this);
				}
				debug(eventName + " on " + win.getId())
			}
		}
		Windows.addObserver(myObserver);
	}
}



function showHoleyFit()
{
	if (fitWin != null)
	{
		Dialog.alert("Close Fitting Tips before opening it again!",{width:200, height:130});
	}
	else
	{
		/* Create my window                    */ fitWin = new Window({className: "alphacube", title: "<b id='drag'>[ Click to drag window ]</b> &nbsp; &nbsp;<b>Holey Fitting Tips</b> &nbsp; &nbsp;<b id='drag'>[ Click to drag window ]</b>", maximizable: false, minimizable: false, resizable: false, hideEffect:Effect.Fade, showEffect:Effect.Appear, minWidth: 10, destroyOnClose: true, top: 200, left: 200 })
		/* Set the content to SPARTAAAAAAA!!!! */ fitWin.setContent('sdri_holey_fit', true, false);
		/* Constrain to window                 */ fitWin.setConstraint(true, {left:10, right:20, top: 135, bottom: 10})
		/* Show the window                     */ fitWin.show();
		
		// Set up a windows observer, check out debug window to get messages
		
		myObserver =
		{
			onDestroy: function(eventName, win)
			{
				if (win == fitWin)
				{
					document.getElementById('sdri_holey_fit_wrapper').appendChild($('sdri_holey_fit'));
					fitWin = null;
					Windows.removeObserver(this);
				}
				debug(eventName + " on " + win.getId())
			}
		}
		Windows.addObserver(myObserver);
	}
}




function showColors()
{
	if (colorWin != null)
	{
		//Dialog.alert("Close View More Colors before opening it again!",{width:200, height:130});
	}
	else
	{
		document.getElementById('tooltip_content1' ).style.display = '';
		/* Create my window                    */ colorWin = new Window({className: "alphacube", title: "<b id='drag'>[ Click to drag window ]</b> &nbsp; &nbsp; &nbsp; <b>Other Colors Available</b> &nbsp; &nbsp; &nbsp; <b id='drag'>[ Click to drag window ]</b>", maximizable: false, minimizable: false, resizable: false, hideEffect:Effect.Fade, showEffect:Effect.Appear, minWidth: 10, destroyOnClose: true, top: 200, left: 500 })
		/* Set the content to SPARTAAAAAAA!!!! */ colorWin.setContent('tooltip_content', true, false);
		/* Constrain to window                 */ colorWin.setConstraint(true, {left:10, right:20, top: 135, bottom: 10})
		/* Show the window                     */ colorWin.show();
		
		// Set up a windows observer, check out debug window to get messages
		
		myObserver =
		{
			onDestroy: function(eventName, win)
			{
				if (win == colorWin)
				{
					document.getElementById('tooltip_content1' ).style.display = 'none';
					document.getElementById('tooltip_content1').appendChild($('tooltip_content'));
					colorWin = null;
					Windows.removeObserver(this);
				}
				debug(eventName + " on " + win.getId())
			}
		}
		Windows.addObserver(myObserver);
	}
}




function swapLargeView( viewID )
{
	for ( i = 1; i < 7; i++ )
	{
		if ( document.getElementById('sdrilargeview' + i ) )
		{
			document.getElementById('sdrilargeview' + i ).style.display = 'none';
		}
	}
	
	document.getElementById(viewID).style.display="block";
}

function getObjectUpperLeft(obj)
{
	var isIE = (navigator.userAgent.toLowerCase().indexOf("msie")!=-1);
	
	var x = obj.offsetLeft;
	var y = obj.offsetTop;
	
	obj = obj.offsetParent;
	while(obj)
	{
		x += obj.offsetLeft;
		y += obj.offsetTop;
		
		if (typeof obj.clientLeft != "undefined" && obj.tagName != "BODY")
		{
			x += obj.clientLeft;
			y += obj.clientTop;
		}
		
		if ( obj.tagName == "HTML" ) break;
		obj = obj.offsetParent;

	}
	
	return {x:x, y:y};

}

function updateHoverGrid( e )
{
	if ( !e ) var e = window.event;
	
	var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
	var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1);
	
	var posx = 0;
	var posy = 0;
	
	if ( e.pageX || e.pageY )
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if ( e.clientX || e.clientY )
	{
		posx = e.clientX;
		posy = e.clientY;
		
		if (isIE)
		{
			posx += document.body.scrollLeft;
			posy += document.body.scrollTop;
		}
	}
	
	var zoomx = document.getElementById('sdri_view1').style.left;
	var zoomy = document.getElementById('sdri_view1').style.top;
	
	hzoom = getObjectUpperLeft(document.getElementById('sdri_view1'));
	
	posx = posx - hzoom.x;
	posy = posy - hzoom.y;
	
	
	if ( ! isIE )
	{
		/* positioning for dogpaw over product image
	document.getElementById( 'sdri_hoverdogpaw' ).style.left = posx - 15 + "px";
	document.getElementById( 'sdri_hoverdogpaw' ).style.top = posy -165+ "px";
	*/
	document.getElementById( 'sdri_hoverimage' ).style.left = Math.round( 0 - ( posx * 6 ) ) +200+ "px";
	document.getElementById( 'sdri_hoverimage' ).style.top = Math.round( 0 - ( posy * 6 ) )  +100+ "px";
	/*	if(posy < 0 || posx < 0 || posy > 172 || posx > 312){
		document.getElementById( 'sdri_hoverdogpaw' ).style.display = "none";
		
		}
		else {
		document.getElementById( 'sdri_hoverdogpaw' ).style.display = "";
		}
		*/
	}
	else
	{
	/* positioning for dogpaw over product image
	document.getElementById( 'sdri_hoverdogpaw' ).style.left = posx - 15 + "px";
	document.getElementById( 'sdri_hoverdogpaw' ).style.top = posy  -170 + "px";
	*/
	document.getElementById( 'sdri_hoverimage' ).style.left = Math.round( 0 - ( posx * 6 ) ) +200+ "px";
	document.getElementById( 'sdri_hoverimage' ).style.top = Math.round( 0 - ( posy * 6 ) ) + 100+"px";
	/*	
		if(posy < -20 || posx < 0 || posy > 120 || posx > 320){
			document.getElementById( 'sdri_hoverdogpaw' ).style.display = "none";
		
		}
		else {
		document.getElementById( 'sdri_hoverdogpaw' ).style.display = "";
		}
		*/
	}
	
	
	
	
	
	
	
	   
	
	}

clearTimer = null;
ratingTimer = null;

function showHoverContent( e )
{
	
	clearTimeout( clearTimer );
	//new Effect.Appear( 'sdri_hoverdogpaw', { duration: 0.1 } );
	//new Effect.Appear( 'sdri_hovercontent', { duration: 0.3 } );
	document.getElementById( 'sdri_hoverdogpaw' ).style.display = "";
	document.getElementById( 'sdri_hovercontent' ).style.display = "";
	
}

function fadeHoverContent() 
{
	document.getElementById( 'sdri_hoverdogpaw' ).style.display = "none";
	//new Effect.Fade( 'sdri_hovercontent', { duration: 0.5 } );
	document.getElementById( 'sdri_hovercontent' ).style.display = "none";
}

function hideHoverContent( e )
{
	
	clearTimeout( clearTimer );
	clearTimer = setTimeout( "fadeHoverContent();", 100 );
}

function cancelProp( e )
{
	
}

function handleRatingPaw( pawRating )
{
	/* PREPARE YOUR BREAKFAST AND EAT HEARTY
	   FOR TONIGHT, WE DINE IN document.all */
	if ( pawRating < 3 )
	{
		pawSrc = "url('images/sdri_rating_red.gif')";
		halfSrc = "url('images/sdri_rating_halfred.gif')";
	}
	else
	{
		pawSrc = "url('images/sdri_rating_green.gif')";
		halfSrc = "url('images/sdri_rating_halfgreen.gif')";
	}
	
		
	for ( i = 1; i <= pawRating; i++ )
	{
		document.getElementById( 'ratingpaw' + i ).style.backgroundImage = pawSrc;
	}
	if((pawRating <2 && pawRating > 1) || (pawRating <3 && pawRating > 2))
	{
		document.getElementById( 'ratingpaw' + i ).style.backgroundImage = halfSrc;
	}
	else if ((pawRating <4 && pawRating > 3) || (pawRating <5 && pawRating > 4))
	{
		document.getElementById( 'ratingpaw' + i ).style.backgroundImage = halfSrc;
	}
	
	
	//document.getElementById( 'ratingpaw' + pawRating ).style.backgroundImage = "url('images/sdri_rating_green.png')";
}

function cancelRatingPaw( )
{
	pawBlank = "url('images/sdri_rating_none.png')";
				
	for( i = 1; i < 6; i ++ )
	{
		document.getElementById( 'ratingpaw' + i ).style.backgroundImage = pawBlank;
	}
}

function handleratingpaw1() { handleRatingPaw( 1 ); }
function handleratingpaw2() { handleRatingPaw( 2 ); }
function handleratingpaw3() { handleRatingPaw( 3 ); }
function handleratingpaw4() { handleRatingPaw( 4 ); }
function handleratingpaw5() { handleRatingPaw( 5 ); }

function doRating( e )
{
	window.location = "http://www.shoedawg.com/dawgreviews.php?act=write&prod=" + product_id;
}

function activateCartButton( e )
{
	/* SPARTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!" */
	document.getElementById('sdri_addtocart').style.backgroundImage = "url('images/sdri_cart.png')";
}

function deactivateCartButton( e )
{
	document.getElementById('sdri_addtocart').style.backgroundImage = "none";
}