// favorites
var xmlhttp_fv=null;
function setfavacvl(ac, vl){
	xmlhttp_fv=null;
	if (window.XMLHttpRequest) {
		// code for all new browsers
		xmlhttp_fv=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		// code for IE5 and IE6
		xmlhttp_fv=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp_fv!=null) {
		var url = "meniu_cautari/set_fav_to_session.php?fvac="+ac+"&fvvl="+vl;
		xmlhttp_fv.open("GET",url,true);
		xmlhttp_fv.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
		xmlhttp_fv.send(null);
	}
}

function isInt(x) {
	var y=parseInt(x);
	if (isNaN(y)) return false;
	return x==y && x.toString()==y.toString();
}
 
function CheckAllBooks() {
	maxSelectionAllowed = 20;
	nrSelections = (document.mc.elements.length <= maxSelectionAllowed) ? document.mc.elements.length : maxSelectionAllowed;
	for (var i = 0; i < nrSelections; i++) {
		if (isInt(document.mc.elements[i].value)){
			if(document.mc.elements[i].type == 'checkbox'){
				document.mc.elements[i].checked = 'checked';
			}
			setfavacvl('add', document.mc.elements[i].value);
		}
	}
}

function CreateBookmarkLink() {
	title = "Webpage Title";
	url = "Webpage URL";
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title);
	}
	else if(window.opera && window.print) { // Opera Hotlist
		return true;
	}
}

