function update_sc_info() {    
    
    //document.getElementById('side_sc_line').style.display = "block";      
    //document.getElementById(active_sc_info).style.display = "block";
}

function close_pop_up() {
  document.getElementById("sc_info").style.display = "none";
}

$(document).ready(function(){
	//start namin doms

	//select cat
	$("#selectable").selectable();
	$("input.add").click(function(){

		var my_id = $("div#selectable div.ui-selected").attr("id");
		var my_txt = $("div#selectable div.ui-selected").text();

		if(!my_id){
		    alert("Plese choose diffrent category");
		} else {
		    $("div#box").append("<div class='ui-widget-content' id='"+my_id+"'>"+my_txt+"<br/><input type='hidden' value='"+my_id+"' name='cat_id[]'/></div>");
		    $("div#selectable div.ui-selected").text("");
		    
		}

	    });

	$("#box").selectable();
	$("input.del").click(function(){
		var my_id = $("div#box div.ui-selected").attr("id");
		var my_txt = $("div#box div.ui-selected").text();
		$("div#box div.ui-selected").html("");			  
	    });

	//start for categories selection according to genre in the backend
	$("select#genre_id").change(function () {
		var str = "";
		$("select#genre_id option:selected").each(function () {
			str = $(this).attr("value");
			str2 = $("div#category").attr("name");
			str3 = $("input#doc_id").attr("name");
			
			$.ajax({ type: "POST", url: "/ajax/get_categories.php",cache:false, asynx:false, data: "gener="+str+"&id_set="+str2+"&type="+str3,  success:function(msg)
				    {       
					//alert(msg);
					var received_text = msg;
					$("div#selectable").html(received_text);	
				    }  
			    });
		    });
	    })
	    .change();
	//end for categories selection according to genre in the backend

//home page read more
  $("#link_readme").click(function () {
      $("#para").slideToggle("slow");
    });



	//start for view details on shop/shop page
	
	$(".pro_details").click(function(){
		var get_name = $(this).attr("name");		
		//alert(get_name);
		
		$.ajax({ type: "POST", url: "/ajax/get_product.php",cache:false, asynx:false, data: "product_id="+get_name,  success:function(msg)
				    {       
					//alert(msg);
					var received_text = msg;
					//alert(received_text);
					$("div#main_div").html(received_text);						
					$("input.add_to_cart").click(aClick);					
				    }  
			    });
	    });
	
	//end for view details on shop/shop page       

	function aClick() {
	    var pro_id = $("#top_head").attr("name");
	    var qty = $("input.quantity").attr("value");	    
	    var size = $("select#size_avi option:selected").attr("value");
	    var color = $("select#col_avi option:selected").attr("value");

	    //alert(size);
	    if(qty == ""){
		qty=1;
	    }

	    var price = $(".act_price_val").html();
	    
	    //alert("pro_id-"+pro_id+", qty-"+qty+", price-"+price);
	    
	    
	    $.ajax({ type: "POST", url: "/ajax/shopping_cart.ajx.php",cache:false, asynx:false, data: "cmd=add_to_cart&pro_id=" + pro_id + "&qty=" + qty + "&color=" + color + "&size=" + size,success:function(msg)			    
			{       
			    //alert(msg);

			    $(".item_num").html(msg);
			    var so = new SWFObject("/flash/sc.swf", "pop_up", 280, 140, "6", "#FFFFFF");
			    so.addParam("wmode", "transparent");
			    so.write("sc_info");
			    document.getElementById('sc_info').style.display = "block";
			}  
		});	    
	}

	$("input.add_to_cart").click(aClick);
				
	//graph popup 
	$("a.graph").click(function(){
		var advert_id = $(this).attr("id");
		//alert(advert_id);
		url = "/php_templates/graph_advert.tmp.php?advert_graph_id=" + advert_id;
		window.open(url,'browser','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=800')
	    });
	
	$("a.episode_graph").click(function(){
		var episode_id = $(this).attr("id");
		//alert(advert_id);
		url = "/php_templates/graph_episode.tmp.php?episode_graph_id=" + episode_id;
		window.open(url,'browser','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=800')

		    });

	$("a.show_graph").click(function(){
		var show_id = $(this).attr("id");
		//alert(advert_id);
		url = "/php_templates/graph_show.tmp.php?show_graph_id=" + show_id;
		window.open(url,'browser','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=800')
		    
		    });


	//end namin dom
    });

