
function go()
{
	var a = window. open('','','scrollbars=yes,width=500,height=500');

	a.document.open("text/html");
	a.document.write('<html><head><style type="text/css">#frame{background-image:none;background-color:#FFFFFF;font-size:18px;}</style></head><body style="font-size:18px;padding-left:20px;background-image:none;background-color:#FFFFFF;"><style> h1{font-size:18px;} table tr td,table tr th{padding-left:15px;font-size:18px; text-align:left;}</style>');
	a.document.write(document.getElementById('print').innerHTML);
	a.document.write('</body></html>');
	a.document.close();
	a.print();

}

$(function(){	
	$("select#getSize").change(function(){ 
		  var selected = $(this).val();  
		    // set loading image  
		    datadiv="covers";
		    ajax_loading_image('',datadiv);  
		    // ajax  
		    $.ajax({  
		        type: "POST",  
		        url: '/ajax/ajx_covers.php',  
		        data: "ajax=true&id="+selected,  
		        success: function(msg){  
		    	   $('#CoverID').val('');
		    	   ajax_remove_loading_image('',datadiv);  
		            $('#'+datadiv).html(msg);  
		            $(".pretty").prettyPhoto({
		    			animationSpeed: "fast",
		    			padding: 40, 
		    			opacity: 0.35, 
		    			showTitle: true, 
		    			allowresize: true, 
		    			theme: "light_rounded" 
		    		});
		            priceCalc(); 	
		        }  
		    });  
		});
	$("select#getPages").change(function(){ 
		priceCalc();
	});
	$("input[type=radio]").click(function(){
		priceCalc();
	});
});
function paggination(ofs) 
{
	  var selected = $('#getSize').val();  
	    // set loading image  
	    datadiv="covers";
	    ajax_loading_image('',datadiv);  
	    // ajax  
	    $.ajax({  
	        type: "POST",  
	        url: '/ajax/ajx_covers.php',  
	        data: "ajax=true&id="+selected+"&ofs="+ofs,  
	        success: function(msg){  
	    	   $('#OfsID').val(ofs);
	    	   $('#CoverID').val('');
	    	   ajax_remove_loading_image('',datadiv);  
	            $('#'+datadiv).html(msg);  
	            priceCalc();
	            $(".pretty").prettyPhoto({
	    			animationSpeed: "fast",
	    			padding: 40, 
	    			opacity: 0.35, 
	    			showTitle: true, 
	    			allowresize: true, 
	    			theme: "light_rounded" 
	    		});
	    
	        }  
	    });  
	}
function ajax_loading_image(div,id) {  
    $('#'+id).html('<img src="/img/loader.gif" alt="Ajax Loading Image"/>');  
}  
  
// remove loading image  
function ajax_remove_loading_image(div,id) {  
    $('#'+id).html('');  
}  
function selectCover(id)
{
	var cover_panel_selected = '#cover_'+id;
	$('#covers > div').attr('class','coverPanel');
	$(cover_panel_selected).attr('class','coverPanelSelected');
	$('#CoverID').val(id);
	priceCalc();
}

function priceCalc()
{
		var datadiv = "prcDiv";
		var size = $("select#getSize").val();
	    var pages = $("select#getPages").val();
	    var cover_id = $('#CoverID').val();
	    var old_order_id = $('#old_order_id').val();
	    
	    if ($('#Metalik').attr('checked'))
	    {
	    	var paper_type=2;
	    }
	    if ($('#OrderType').attr('checked'))
	    {
	    	var order_type=2;
	    }
		
		if(size && pages)
		{
			ajax_loading_image('',datadiv);  
			$.ajax({  
		        type: "POST",  
		        url: '/ajax/ajx_price.php',  
		        data: "ajax=true&size="+size+"&pages="+pages+"&cover_id="+cover_id+"&paper_type="+paper_type+"&order_type="+order_type + "&old_order_id=" + old_order_id,  
		        success: function(msg){  
		    	   ajax_remove_loading_image('',datadiv);  
		            $('#'+datadiv).html(msg);  
		        }  
		    });  
		}
}
function selectAll()
{
    $("#recSelector option").attr("selected","selected");	
}
