
$(function() {
	
	// $(".contentArea a").css({
		// "text-decoration" : "none"
	// });	
	
	$("#slideCell").css({
		//"width" : $("#slideCell").width() + 10
	});
	/*
	$("#mainSection").css({
		//"top" : $("#menuSection").offset().top + $("#menuSection").css("height"),
		"top" : $("#menuSection").offset().top + $("#menuSection").height(),
		"left" : $("#menuSection").offset().left,
		"margin-left": "auto",
		"margin-right" : "auto",
		"padding-left" : "10px"
	});
	*/
	
	if (document.all||document.getElementById) {
		//Swindow.onload=new Function('setInterval("bgSlide()",3000)');
	}
	//alert("hello");	

	$('.mix').each(function() {
		//eval($(this).text());
	});

	$(window).resize(function() {
		//alert("hello");
		$("#slideCell").css({
			//"left" : $("#slideCell").offset().left - 10
		});
	});
	
	/*
	jQuery.each(jQuery.browser, function(i) {
		if($.browser.msie && $.browser.version < 8){
			$("#slideCell").css({
				"left" : "0px"
			});
		}
	});	
	*/
	
	//var bgImages = [ 'homepage-rotate-2.jpg', 'homepage-rotate-2.jpg', 'homepage-rotate-3.jpg', 'homepage-rotate-3.jpg' ];
	var bgImages = [ 'main-switcher2.png', 'main-switcher3.png', 'main-switcher4.png', 'main-switcher.png' ];	
	var currImage = 'main-switcher.png';
	var bgItem = 0;
	var bgLinks = [ 'products-t-shirts.php', 'products-labels.php', 'products-printing.php', 'products-weddings.php' ];
	var prevLink;
	var nextLink;
	var options = {};
	
	//setInterval( function(){
		/*
		do{
			var randImage = bgImages[Math.ceil(Math.random()*(bgImages.length-1))];
		}while( randImage == currImage )
		currImage = randImage;
		*/
		
		// if (bgItem > 0) {
			// prevImg = bgImages[bgItem - 1];
			// prevLink = bgLinks[bgItem - 1];
		// } else {
			// prevImg = bgImages[bgImages.length - 1];
			// prevLink = bgLinks[bgImages.length - 1];
		// }
		
		// if (bgItem == bgImages.length - 1) {
			// nextImg = bgImages[0];
			// nextLink = bgLinks[0];
		// } else {
			// nextImg = bgImages[bgItem + 1];
			// nextLink = bgLinks[bgItem + 1];
		// }
		
		//if (turns == 0) {
	
		setTimeout(function() {
			$('#slideCell').BgImageTransition( bgImages, bgLinks, options );
		}, 6000);
		
		//$('#slideCell').BgImageTransition( bgImages, bgLinks, options );
		//}
		//
		//$('#mainSection').append(randImage);
		
		//$(".contentArea").prepend(bgImages[bgItem]);		
		
		/*
		$('.slide').each(function() {
			if ($(this).is(':visible')) {
				console.log($(this).attr('id'));
				$(this).find('a').attr('href', bgLinks[bgItem]);
			} else {
				$(this).find('a').attr('href', prevLink);
			}		
		});
		*/
		/*
		if ($('#slideCell2').is(':visible')) {
			console.log('visible');
			if (turns == 1) {
				$('#slideCell2').find('a').attr('href', nextLink);
			} else {
				$('#slideCell2').find('a').attr('href', nextLink);
			}
			
			//$('#slideCell').find('a').attr('href', nextLink);
		} else {
			//$('#slideCell2').find('a').attr('href', nextLink);
			if (turns == 1) {
				$('#slideCell').find('a').attr('href', nextLink);
			} else {
				$('#slideCell').find('a').attr('href', nextLink);
			}
		}
		*/
		
		
		// if (bgItem == bgImages.length - 1) {
			// bgItem = 0;
		// } else {
			// bgItem++;
		// }
		
		// turns++;
	
//	}, 9000);
	

});



