﻿var myMenu;
	window.onload = function() {
		myMenu = new SDMenu("my_menu");
		myMenu.init();
		myMenu.expandAll()
	};
	js = {};
js.include = function(path) {
	document.write('<script type="text/javascript" src="'+path+'"></sc'+'ript>');
}		

//js.include("sdmenu/jquery.js");
js.include("title.js");
js.include("sdmenu/sdmenu.js");
//js.include("sdmenu/UI/js/jquery-1.5.1.min.js");
//js.include("sdmenu/UI/js/jquery-ui-1.8.14.custom.min.js");
//js.include("sdmenu/up2.js");

function BySelected(element) {
	if( element.options[element.selectedIndex].value!='' ) {
		window.location = element.options[element.selectedIndex].value;
	}
		}
function ByRows(element) {
	if( element.options[element.selectedIndex].value!='' ) {
		window.location = element.options[element.selectedIndex].value;
	}
		}

function notepad_open(){
	$('#dialog').dialog('open');
					get_note();
					}
function add_notepad(id)   
        {  
            $.ajax({   
			type: "GET",
                url: "notepad.php",   	
				 data: "add="+id,
                success: function(html){   
                    $("#content").html(html);   
                }   
            });   
        }
		function del_all()   
        {  
            $.ajax({   
			type: "GET",
                url: "notepad.php",   	
				 data: "del=del_all",
                success: function(html){   
                  get_note();
                }   
            });   
        }
			function get_note()   
        {  div_down = document.getElementById("notes");
		   div_down.innerHTML = "<center>Пожалуйста подождите, идет загрузка записей<br><img src=sdmenu/note_load.gif></center>";
            $.ajax({   
			type: "GET",
                url: "notepad.php",   	
				 data: "get=1",
                success: function(html){   
					div_down.innerHTML = html;
					}
            });  			
        }
	function delete_notepad(id)   
        {  
            $.ajax({   
			type: "GET",
                url: "notepad.php",   	
				 data: "del="+id,
                success: function(html){   
                    $("#content").html(html);   
                }   
            });   
        }
function checker(cb,id){
if(cb.checked){
add_notepad(id);
  alert("Товар успешно добавлен в блокнот");
} else { delete_notepad(id);  alert("Товар удален из блокнот");}
}
