// JavaScript Document
if(!Array.indexOf){
   Array.prototype.indexOf = function(obj){
      for(var i=0; i<this.length; i++){
         if(this[i]===obj){
            return i;
         }
      }
      return -1;
   }
}
$(function(){
	var shape_array = [];
	$("#tabs").tabs();
	$('#diamond-shape-list li').click(function(){
		pattern = /^([a-z]+)-down$/;
		if(!pattern.test($(this).attr('class')))
		{
			shape = $(this).attr('class');
			$('.'+shape).attr('class',shape+'-down');
			
			if(new RegExp('^('+ shape_array.join('|') +')$').test(shape) != true)
				shape_array.push(shape);
		}
		else
		{			
			down_shape = $(this).attr('class');
			shape = $(this).attr('class').split('-');
			$('.'+down_shape).attr('class',shape[0]);
			shape_array.splice(shape_array.indexOf(shape[0]),1);
		}		
		return false;
	});
	$('#search-diamonds').click(function(){
		window.location='diamond-search.php?shape_list='+shape_array.join(',');
		return false;
	});	
	$('#flash').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout: 5000,
		speed: 1000,
		containerResize: false,
		height: '260px', 
		slideExpr: 'img',
		pager:  '#pager-nav',
		prev:    '#prev',
        next:    '#next'		
	});
	/*					
	*/
});
