var templateIsOpen = false;


function setSessionType(type,id) {
	$.ajax({ 
	   type: "POST", 
	   url: "/tosession.php", 
	   data: "action=template_type&type="+type, 
	   success: function(msg){ 
			window.location.href = "/"+ id +"/";
	   }

	 });
}

function openTemplate(type,thisa,id) {	
	if(templateIsOpen == false) {
		templateIsOpen = true;
		
		$(thisa).css('color','black');
		$(thisa).css('font-weight','bold');
		
		setSessionType(type,id);
		
		/*$.get('index.php?template_contents=1&item='+id,  function(data) {
			var templateContent = data;
			
			$("#intro-bg-lowers").slideUp(2000, function() {
			
					$("#intro-bg-lowers").html("");
					$("#intro-bg-lowers").css("background","");
					
					
					$('#intro-bg-lowers').html(templateContent);
					$('#intro-bg-lowers').css('height',($('#main-container').height() - 197+'px'));
					$('#main-container').css('margin-top','-197px');
					//$('body').load('index.php', {template_contents: 1}, function() {
					$('#main-container').css('display','block');
						//$("#main-container").slideUp(0);
						$("#intro-bg-lowers").slideDown(2000, function() {
							setSessionType(type,id);
						});
					//});
			});
		});*/
	}
	
}

function changeTemplate(type,id) {
	setSessionType(type,id);
	
	return false;
}

$(document).ready(function(){
	
});
