

 //Variables
     var last=null;	
     var iconoption='0';
     var fnid='#First';
     var lastshot=null;
     cursor_display = 0;
     var icon_location = 0;
     var scrollsection = 'no';
     icon_click = 0;
     var lastclick = null;
     var ie = null;
     ajax_init = null;
     
     




function _init_page()
	{
	if (page_init == 0)
		{
			
			var stage1 = 2400;
			var stage2 = 1000;
			var stage3 = 3000;
			var stage4 = 1800;
			var stage5 = 1500;
			
			var hold1 = 1400;
			var hold2 = 0
			var hold3 = hold2 + stage2;
			var hold4 = hold3 + stage3;
			var hold5 = hold4 + stage4;	
			
			$('.container, .coverups').css('opacity', '.0');
			$('.container, .coverups').css('display', 'block');
			$('.container, .coverups').css('width', '5px');
			$('#catalog').css('opacity' , '0');
			$('#catalog').css('display' , 'block');
			$('div.top_menu').css('opacity' , '0');
			$('div.top_menu').css('display' , 'block');
			$('div.main_menu').css('opacity' , '0');
			$('div.main_menu').css('display' , 'block');
			$('#FirstCenter').css('opacity' , '0');
			$('.header').css('left' , '-1000px');
			$('.header').css('display' , 'block');
			
			/*$('div.screencontent').css('opacity' , '1');*/
			$('div.container').scrollTo( '1600px' , {duration:10 , axis:'x' , easing:'swing' , offset:-250} );

			
			$('#open').css('display', 'none');
			$('.loader').css('display', 'block');
			$('.loader').css('width', '100%');
			$('.loader').css('height', '100%');
			//$('.loader').css('left', '50%');
			
			//$('#open').css('float', 'right');
			$('#open').css('height', '700px');
			$('#open').css('opacity', '0');
			$('#open').css('display', 'block');

			
			$('#open').animate 
				({height: '700px', top: '1%' , opacity:'1'} , 4000 ).animate
				({height: '224px', top: '20px' , left: '0' } , stage2, 
				
					function() {
				
					//$('.loader').css('height', '200px');
	
					$('.loader').css
						({ top: '20px', height: '230px' , left: '50px'});
							$('.loader').css('width', '300px');
							$('#header').animate
								({left: '50px'} , 1000 );
				
									$('.container').animate
										({ width: '100%' , opacity:'1'} , 1200 );
									
									$('.coverups').animate
										({ width: '100%' , opacity:'1'} , 1200,
										
										function () {
										
										
												$('#catalog').animate
													({ opacity:'1'} , 2000 , 
													
													function () {
												
														$('#FirstCenter').css("opacity", '1');		
																
																$('div.container').scrollTo( '0px' , {duration:1200 , axis:'x' , easing:'swing' , offset:-250} );
																		
																$('div.top_menu').animate
																	({ opacity:'0'} , 2000, 
																	
																	function() {
																
																		$('div.top_menu').animate
																			({ opacity:'1'} , 5000 );
																		
																		$('div.main_menu').animate
																			({ opacity:'1'} , 5000 );
																
																	
																	
																	});
												
												
								
												
										
												});
		
		
		
									});	
		
		
				});
			
			$('.loader').css('position','absolute');
			$('.loader').css('width','100px');
			
			page_init=1;
		}
	
	if (page_init == 1)
		{ _init_no_intro() }
	}
	
function _init_page_ie()
	{
	if (page_init == 0)
		{
			
			var stage1 = 2400;
			var stage2 = 1000;
			var stage3 = 3000;
			var stage4 = 1800;
			var stage5 = 1500;
			
			var hold1 = 1400;
			var hold2 = 0
			var hold3 = hold2 + stage2;
			var hold4 = hold3 + stage3;
			var hold5 = hold4 + stage4;	
			
			$('.container, .coverups').css('opacity', '0');
			$('.container, .coverups').css('display', 'block');
			$('.container, .coverups').css('width', '1em');
			$('#catalog').css('opacity' , '0');
			$('#catalog').css('display' , 'block');
			$('div.top_menu').css('opacity' , '0');
			$('div.top_menu').css('display' , 'block');
			$('div.main_menu').css('opacity' , '0');
			$('div.main_menu').css('display' , 'block');
			$('#FirstCenter').css('opacity' , '0');
			$('.header').css('left' , '-1000px');
			$('.header').css('display' , 'block');
			
			/*$('div.screencontent').css('opacity' , '1');*/
			$('div.container').scrollTo( '1600px' , {duration:10 , axis:'x' , easing:'swing' , offset:-250} );

			
			$('#open').css('display', 'none');
			$('.loader').css('display', 'block');
			$('.loader').css('width', '100%');
			$('.loader').css('height', '100%');
			//$('.loader').css('left', '50%');
			
			//$('#open').css('float', 'right');
			$('#open').css('height', '700px');
			$('#open').css('opacity', '0');
			$('#open').css('display', 'block');

			
			$('#open').animate 
				({height: '700px', top: '1%' , opacity:'1'} , 4000 ).animate
				({height: '224px', top: '20px' , left: '0' } , stage2, 
				
					function() {
				
					//$('.loader').css('height', '200px');
	
					$('.loader').css
						({ top: '20px', height: '230px' , left: '50px'});
							$('.loader').css('width', '300px');
							$('#header').animate
								({left: '50px'} , 1000 );
				
									$('.container').animate
										({ width: '100%' , opacity:'1'} , 1200 );
									
									$('.coverups').animate
										({ width: '100%' , opacity:'1'} , 1200,
										
										function () {
										
										
												$('#catalog').animate
													({ opacity:'1'} , 2000 , 
													
													function () {
												
														$('#FirstCenter').css("opacity", '1');		
																
																$('div.container').scrollTo( '0px' , {duration:1200 , axis:'x' , easing:'swing' , offset:-250} );
																		
																$('div.top_menu').animate
																	({ opacity:'0'} , 2000, 
																	
																	function() {
																
																		$('div.top_menu').animate
																			({ opacity:'1'} , 5000 );
																		
																		$('div.main_menu').animate
																			({ opacity:'1'} , 5000 );
																
																	
																	
																	});
												
												
								
												
										
												});
		
		
		
									});	
		
		
				});
			
			$('.loader').css('position','absolute');
			
			page_init=1;
		}
	
	if (page_init == 1)
		{ _init_no_intro() }
	}

function _init_no_intro()
{

		
$('.loader').css('position','absolute');
//$('.loader').css('display','block');
//$('.loader').css('opacity','0');
$('#open').css('height','224px');
$('.loader').css('top' ,'20px')
$('.loader').css('height' , '230px');
$('.loader').css('left' , '50px');
$('.loader').css('width', '300px');		
$('.loader').fadeIn("slow");



				
}
		        
function _init_ajax()
	{
	$('div.coverall').css('top' , '0');
	$('div.coverall').css('left' , '0');
	$('div.coverall').css('opacity' , '0');
	$('div.coverall').css('display' , 'block');
	$('div.coverall').css('width' , '2000px');
	$('div.coverall').css('height' , '1800px');
	$('div.product_detail').css('opacity' , '0.0');
	$('div.product_detail').css('display' , 'block'); 
	$('div.product_detail').css('left' , '15%'); 
	
	//$('div.icon_container').css('display' , 'none'); 

	$('div.coverall').animate
		({opacity:'.7'} , 500 , 
		
		function() {
			$('div.product_detail').animate
				({opacity:'1'} , 1800 );
			
		});
	
	        lastclick = null;

	
	} 
	
function _close_productpage()
	{
	$('div.product_detail').css('display' , 'none');
	//$('div.icon_container').css('display' , 'block'); 
	$('div.dropdowns_BeltsStraps').css('display' , 'none');
	$('div.coverall').animate
		({left: '0', opacity:'0'} , 800 );
	$('div.coverall').animate
		({left:'6000'} , 50 );
	
	
	buythislast=('div#buyoption0');
	seethislast=('img#optionimage0'); 
	init_ajax = 0;
	var lastclick=null;
	
	}	
	
function _display_cursor (action)
  {
  
	  if (action == 'show')
		{
			$('div.icon_scroller_fwd').css('display' , 'block');
			$('div.icon_scroller_back').css('display' , 'block');
			cursor_display  = 1;
		}
  
  	 if (action == 'hide')
		{
			$('div.icon_scroller_fwd').css('display' , 'none');
			$('div.icon_scroller_back').css('display' , 'none');
			cursor_display  = 0;
		}

 }	
	
function _init_productpage()
	{
	
	
	if (ajax_init == 0)
      	{
		//$('img[@src$=.png]').ifixpng(); 
		//$('div.product_detail').ifixpng();
		buythislast=('div#buyoption0');
		seethislast=('img#optionimage0');
    	
		$('div#buyoption0').css('display' , 'block');
		$('div#buychoice0').css('display' , 'block');
		
		$('#back').click(function()
			{
			 _close_productpage()
			 });
	
		$('a.more').click(function()
			{
				   _show_closeup();

	 				
						 
			 });
	
		$('img.optionimage').click(function()
			{
			
			var newimage=$(this).attr('src');
			var buychoice='div#buyoption'+$(this).attr('rel');
			
			if (newimage == 'images/products/beltsizingandinfo.jpg')
				{ var newimage='images/products/belt_info_image.jpg';}

			
			
			
			
			if (this == seethislast) 
				{
					$(this).css('border' , '1px solid #244d56');
				}
				else
				{
					//$(this).css('padding' , 'none');
					$(this).css('border' , '1px solid #244d56');	
					$(buythislast).css('display' , 'none');
					$(seethislast).css('border' , '1px solid black');
					$('img#option_target').css ('opacity' , '0');
					$('img#option_target').attr('src' , newimage);
					$('img#option_target').animate ({opacity:'1'} , 600);
					$('img#option_target').attr('z-index' , '1');

					
					var infocheck = $(this).attr('rel');

					
				
					
					buythislast=buychoice;
					seethislast=this;
				 }
						 
		});
	
	ajax_init=1; //reset init value
	$.scrollTo( $('div.product_detail') , {duration:800 , offset: -100} );

	//$("a#addtocart").click(function(){
		//add_to_cart(item);
	//});
	
	}
}





	
function _launchbox(clicked)
{
  icon_click = 1;
        ajax_init=0;
        var item = $(clicked).attr("rel");
        lastclick = clicked;
       // $("div#show_product").load("http://www.devilsmaycare.com/main/test.html");
      // loadURL = "http://www.devilsmaycare.com/main/expression/?random="+Math.random()*99999;
       loadURL = "?random="+Math.random()*9999;
        //$("div#show_product").load(loadURL,  { "item" : item } );
        

        
       $("div#show_product").load("http://www.devilsmaycare.com/main/expression/??random="+Math.random()*99999+"&item="+item);

          // function(){ within expression click      $("#show_product").load("?ajaxload=true&passedproductID="+item, function(){
        
        }
	

function _show_closeup()
	{
	
	flip = 0;
$('div.upclose').toggle("slow");
$('a#upcloseimage img').click(function() {
		if (flip == 0){
	$('div.upclose').toggle("slow");
	flip = 1;
		}
	});


	}	
	
	
function _show_closeup_ie()
	{
	$('div.product_detail').animate ({left:'-1900'} , 600);
	$('div.upclose').css('display' , 'block');
	$('div.upclose').css('position' , 'absolute');
	$('div.upclose').css('left' , '2000px');
	$('div.upclose').css('top' , '20px');
	$('div.upclose').animate ({left:'15%'} , 600);
	$('div.upclose').click(function(event) {
			$('div.product_detail').animate ({left:'15%'} , 600); 
			$('div.upclose').css('position' , 'fixed');
			$('div.upclose').css('display' , 'block'); 
			$('div.upclose').animate ({left:'2000px'} , 600);
		});
	
	}	
	
	
function _move_catalog(passed)
	{
	var catalogshot='#'+$(passed).attr('rel')+'Catalog';
	if ((catalogshot != lastshot)) 
		{
		$('div.container').scrollTo( $(catalogshot) , {duration:800 , axis:'x' , easing:'swing' , offset:-325} );
		lastshot=catalogshot;
		}
	}
	
function _move(passed)
	{
			
			if (scrollsection == 'yes')
			{
			
			fnid='#'+$(passed).attr('id');
			var menuid=fnid +'Nav';
			var scrollmove=fnid +'Center';
	
			$('div.container').scrollTo( $(scrollmove) , {duration:1000 , axis:'x' , easing:'swing' , offset:1550} );
			scrollsection = 'no';
			
			}
	
	
	}

function _moveFirst(passed)
	{
			
			if (scrollsection == 'yes')
			{
			
			fnid='#'+$(passed).attr('id')+'ShirtsSS';
			var menuid='#'+$(passed).attr('id')+'ShirtsSSNav';
			var scrollmove=fnid +'Center';
	
	
			$('div.container').scrollTo( $(scrollmove) , {duration:1000 , axis:'x' , easing:'swing' , offset:1550} );
			scrollsection = 'no';
			
			}
	
	
	}


function _goto_category(passed)
	{
		icon_location = 0;
		$(last).addClass('subMenu');
		
		fnid='#'+$(passed).attr('id');
		var menuid=fnid +'Nav';
		var scrollmove=fnid +'Center';
		
		
		$('div.icon_container').scrollTo( '#section1' , {duration:10 , axis:'x' , easing:'swing' , offset:0} );
	
		$(menuid).removeClass('subMenu');

		$('div.icon_bar').css('opacity' , '0');
		$('div.icon_bar').css('left' , '2000px');
		$('div.icon_bar').animate
			({left:'0' , opacity:'1'} , 1000 ); 
			
		_display_cursor ('show')
		last=menuid; 
		
	}
	
         

function _goto_category_first(passed)
	{
	
	 icon_location = 0;
	$(last).addClass('subMenu');
	
	fnid='#'+$(passed).attr('id')+'ShirtsSS';
	var menuid='#'+$(passed).attr('id')+'ShirtsSSNav';
	var scrollmove=fnid +'Center';
	
	$('div.icon_container').scrollTo( '0px' , {duration:10 , axis:'x' , easing:'swing' , offset:0} );
				
	
	$(menuid).removeClass('subMenu');
	
	$('div.icon_bar').css('opacity' , '0');
	$('div.icon_bar').css('left' , '2000px');
	$('div.icon_bar').animate
	({left:'0' , opacity:'1'} , 1000 ); 
	
	 
	 _display_cursor ('show')
	
	last=menuid; 
	
	}
	
function _goto_liasion()
	{
	icon_location = 0;
	$('div.cat_icon').attr('class' , 'subMenu');
	fnid='#liason';
	var menuid='#liason_icon';
	
	$(menuid).removeClass('subMenu');
	$('div.icon_bar').css('opacity' , '0');
	$('div.icon_bar').css('left' , '2000px');
	$('div.icon_bar').animate
	({left:'0' , opacity:'1'} , 2000 ); 
	
	$('div.icon_container').scrollTo( '0px' , {duration:10 , axis:'x' , easing:'swing' , offset:0} );

	
	$('div.container').scrollTo( $('#liasonCenterImage') , {duration:1000 , axis:'x' , easing:'swing' , offset:-150} );
	last=menuid;  
	
	
	 _display_cursor ('show')
	 
	 
	}
	
	
function _goto_topnav(passed)
	{
	icon_location = 0;
	$('div.cat_icon').attr('class' , 'subMenu');
	$('div#liason_icon').attr('class' , 'subMenu');
		fnid='#'+$(passed).attr('id');
	var catalogshot2='#'+$(passed).attr('id')+'CenterImage';
	
	$('div.container').scrollTo( $(catalogshot2) , {duration:1000 , axis:'x' , easing:'swing' , offset:-250} );
	
	hide = 1;
	_display_cursor ('hide')
	 
	}         			
				
	
function _renameicons()
{
$("a.iconclick").attr("href" , function (arr) {
          pid = $(this).attr("rel");
          return "javascript:replace('show_product', '"+pid+"')";
        })
       


}
 
 
  $(document).ready(function(){

 
jQuery.each(jQuery.browser, function(i) {
  if($.browser.msie){
   
   _init_page_ie()
   ie = true;
     
  }else{
     _init_page()
  }
});

 
 if (ie == true) {
// _renameicons()
  }

  $("#loading").bind("ajaxSend", function(){
           $(this).show();
           
     }).bind("ajaxComplete", function(){
           $(this).hide();
           
             if (icon_click == 1)
             {
             _init_ajax()
             _init_productpage()
             icon_click =0;
             }
     });
     
     

      
 /*	$('ul.side_menu').click(function()
		{$('div.icon_container').scrollTo('0px' , {duration:300 , axis:'x' , easing:'swing' , offset:-250} );  
		});
*/		
		
    $('.misc').click(function()
            	{
            	_goto_topnav(this)
            	});
         		
	$('a.goto_liason').click(function()
				{
				_goto_liasion()
				});         		
        
					
    $('.icon').click(function() {
        icon_click =1;
        }); 
        
   $('a.iconclick').click(function() {
 
 	if (this !=lastclick){	
 		
     _launchbox(this)
        }
        	
        });         
	
	$('div.coverall').click(function()
            { 
            _close_productpage()
            });   
            
              
           
	$('#fwd_scroll').click(function()
			{
			$('div.icon_container').scrollTo('+=920px' , {duration:1000 , axis:'x' , easing:'swing' , offset:-250} );   
			  
			icon_location = icon_location+1;
  
			});
 
	$('#back_scroll').click(function()
			{
			$('div.icon_container').scrollTo('-=920px' , {duration:1000 , axis:'x' , easing:'swing' , offset:-250} );   
			});
         
	$('a.iconclick').mouseover(function()
			{
			_move_catalog(this)
			});
         
	 $('a.gotoppp').click(function()
		{
		_goto_category(this)
		scrollsection = 'yes';
		}).mouseout(function()
		{_move(this)});
          
	$('a.menu_catttt').click(function()
       {
      	_goto_category_first(this)
      	scrollsection = 'yes';
		}).mouseout(function()
		{_moveFirst(this)}); 
		
					
	
			$('div.container').scrollTo( $('div.section1').eq(0) , {duration:1000 , axis:'x' , easing:'swing' , offset:-250} );


//end DOM Read Function
  });
  

  
  
 