

//intialize

function intialize_image_viewer(){
	
	window.key = '0thumb';

	title = thumb_imgs[0][1];

	desc = thumb_imgs[0][2];

	icon_src = thumb_imgs[0][3];

	/*document.getElementById("image-src").style.backgroundImage = "url("+thumb_imgs[0][0]+")";*/

	document.getElementById("image-src").innerHTML = '<img src="' + thumb_imgs[0][0] + '" width="340" height="340" />';

	updateProdInfo(title,desc,icon_src);	

	var x = document.getElementById('prod-image-info');

	desc != '' ? x.style.display = 'block' : x.style.display = 'none';
	
	/*
	
	if (thumb_imgs[0][2] != ''){

		document.getElementById('image-info-desc-title').innerHTML = thumb_imgs[0][1];

		document.getElementById('image-info-desc-text').innerHTML = thumb_imgs[0][2];

		document.getElementById('image-info-tech-icon').style.background = "url("+thumb_imgs[0][3]+")";

		document.getElementById('prod-image-info').style.display = 'block';

	} else {

		document.getElementById('prod-image-info').style.display = 'none';

	}

	$(document).ready(function(){

		$("#prod-info").show(500);

	});

	*/	

	//document.getElementById('prod-info').style.display = 'block';	

}

function dispImage(key, type, imagename){
	if (window.key != key+type) {
		window.key = key+type;
		var divTabEnd = document.getElementById('image-info-tab-end');
		switch(type){
			case "thumb":
				src = imagename;				
				//title = thumb_imgs[key][1];
				//desc = thumb_imgs[key][2];
				//icon_src = thumb_imgs[key][3];
				break;
			case "color":
				src = color_imgs[key][0];
				break;
			default:
			  alert('no type defined');
		}
		$(document).ready(function(){
			$("#image-src").fadeOut(400, function () {
				//document.getElementById("image-src").style.backgroundImage= "url("+src+")";
				document.getElementById("image-src").innerHTML = '<img src="i/' + src + '" width="340" height="340" />';
				//alert(document.getElementById("image-src").innerHTML);
				/*document.getElementById("image-src").innerHTML = '<a href="' + icon_src + '" rel="lightbox[images]"><img src="' + src + '" /></a>';*/
				$("#image-src").fadeIn(400);
			});
			/*if (type == 'thumb' && desc != '' && divTabEnd.className == ''){
				updateProdInfo(title,desc,icon_src);
				$("#prod-image-info").fadeIn(400);
			} else if (type == 'thumb' && desc != '' && window.reopen != true && divTabEnd.className == 'open'){
				$("#prod-image-info-inside").hide(400);
				$("#prod-image-info .inside").animate({ width: "0px"}, 400, function () {
					updateProdInfo(title,desc,icon_src);
					$("#prod-image-info .inside").animate({ width: "492px"}, 400);
					$("#prod-image-info-inside").show(400);
				});
			} else if (type == 'thumb' && desc != '' && window.reopen == true){
				window.reopen = false;
				updateProdInfo(title,desc,icon_src);
				$("#prod-image-info").fadeIn(400);
				$("#prod-image-info .inside").animate({ width: "492px"}, 400);
				$("#prod-image-info-inside").toggle(400);
			} else if (type == 'color' || desc == '') {
				$("#prod-image-info .inside").animate({ width: "0px"}, 300);
				$("#prod-image-info-inside").hide(300, function () { 
					$("#prod-image-info").fadeOut(100, function () {
						divTabEnd.className == 'open' ? window.reopen = true : divTabEnd.className = '';
					}); 
				});
			}*/
		});
	}
}

function updateProdInfo(prod_title,prod_desc,prod_icon_src) {

	/*document.getElementById('image-info-desc-title').innerHTML = prod_title;

	document.getElementById('image-info-desc-text').innerHTML = prod_desc;

	if (icon_src) {

		document.getElementById('image-info-desc-title').style.marginLeft = '147px';

		document.getElementById('image-info-desc-text').style.marginLeft = '147px';

		document.getElementById('image-info-desc').style.backgroundImage = "url("+prod_icon_src+")";

	} else {

		document.getElementById('image-info-desc-title').style.marginLeft = '10px';

		document.getElementById('image-info-desc-text').style.marginLeft = '10px';

		document.getElementById('image-info-desc').style.backgroundImage = "";

	}*/
}



function toggleProdInfo() {

	$(document).ready(function(){

		$("#prod-image-info-inside").toggle(500);

		if (document.getElementById('image-info-tab-end').className == 'open'){

			$("#prod-image-info .inside").animate({ width: "0px"}, 500);

		}else{

			$("#prod-image-info .inside").animate({ width: "492px"}, 500);

		}

	});

	var n = document.getElementById('image-info-tab-end');

	n.className == '' ? n.className = 'open' : n.className = '';

}

function products_carousel_initCallback(carousel) {

    jQuery('#products-carousel-next').bind('click', function() { carousel.next(); return false; });

    jQuery('#products-carousel-prev').bind('click', function() { carousel.prev(); return false; });

};

function colors_carousel_initCallback(carousel) {

    jQuery('#colors-carousel-next').bind('click', function() { carousel.next(); return false; });

    jQuery('#colors-carousel-prev').bind('click', function() { carousel.prev(); return false; });

};

function playersclub_carousel_initCallback(carousel) {

    jQuery('#products-carousel-next').bind('click', function() { carousel.next(); return false; });

    jQuery('#products-carousel-prev').bind('click', function() { carousel.prev(); return false; });

};

function colors_carousel_buttonPrevCallback(carousel, button, enabled) {

	var n = document.getElementById("colors-carousel-prev");

	//enabled ? n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Red_back.png)" : n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Gray_back.png)";

	enabled ? n.style.color="#000000" : n.style.color="#999999";

	enabled ? n.className = 'hand' : n.className = '';

};

function colors_carousel_buttonNextCallback(carousel, button, enabled) {

	var n = document.getElementById("colors-carousel-next");

	//enabled ? n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Red_forward.png)" : n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Gray_forward.png)";

	enabled ? n.style.color="#000000" : n.style.color="#999999";

	enabled ? n.className = 'hand' : n.className = '';

};

function products_carousel_buttonPrevCallback(carousel, button, enabled) {

	var n = document.getElementById("products-carousel-prev");

	//enabled ? n.innerHTML='<img src="../images/prev-hover-arrow.png" />' : n.innerHTML='<img src="../images/prev-arrow.png"';
	
	enabled ? n.style.backgroundImage="url(../images/prev-hover-arrow.png)" : n.style.backgroundImage="url(../images/prev-arrow.png)";

	//enabled ? n.style.color="#000000" : n.style.color="#999999";

	enabled ? n.className = 'hand' : n.className = '';

};

function products_carousel_buttonNextCallback(carousel, button, enabled) {

	var n = document.getElementById("products-carousel-next");

	enabled ? n.style.backgroundImage="url(../images/next-hover-arrow.png)" : n.style.backgroundImage="url(../images/next-arrow.png)";
	
	//enabled ? n.innerHTML='<img src="../images/next-hover-arrow.png" />' : n.innerHTML='<img src="../images/next-arrow.png"';

	//enabled ? n.style.color="#000000" : n.style.color="#999999";

	enabled ? n.className = 'hand' : n.className = '';

};

function playersclub_carousel_buttonPrevCallback(carousel, button, enabled) {

	var n = document.getElementById("playersclub-carousel-prev");

	//enabled ? n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Red_back.png)" : n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Gray_back.png)";

	enabled ? n.style.color="#000000" : n.style.color="#999999";

	enabled ? n.className = 'hand' : n.className = '';

};

function playersclub_carousel_buttonNextCallback(carousel, button, enabled) {

	var n = document.getElementById("playersclub-carousel-next");

	enabled ? n.style.color="#000000" : n.style.color="#999999";

	//enabled ? n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Red_forward.png)" : n.style.backgroundImage="url(/sites/all/themes/warriorgear/images/product_temp/Arrow_Gray_forward.png)";

	enabled ? n.className = 'hand' : n.className = '';

};




