function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

var checkedAll = 0;

function checkAll() {

	if (document.compare) {
		for (var i = 0; i < document.compare.length; i++) {
			if (checkedAll == 1) {
				document.compare.elements[i].checked = false;
				
			} else {
				document.compare.elements[i].checked = true;
				
			}
		}
	}
	
	if (checkedAll == 1) {
		checkedAll = 0;
	} else {
		checkedAll = 1;
	}
	
}

function pagejump(link) {
	var ocmp = '{CMP}';
	if (ocmp != 'no') {
		var arrocmp = ocmp.split(",");
	} 
	
	
	var arrcmp = new Array();

	if (document.compare) {
	
	for (var i = 0; i < document.compare.length; i++) {
		if (document.compare.elements[i].checked) {
			var test = 0;
			if (ocmp != 'no') {
				for (var j = 0; j < arrocmp.length; j++) {
					if (arrocmp[j] == document.compare.elements[i].value) test = 1;
				}
			}
			if (test == 0) {
				var pushed = arrcmp.push(document.compare.elements[i].value);
			}
			
		} else {
			if (ocmp != 'no') {
				for (var j = 0; j < arrocmp.length; j++) {
					if (arrocmp[j] == document.compare.elements[i].value) arrocmp.splice(j,1);	
				}
			}
		}
		
	}
	if (ocmp != 'no') {
		var newcmp = arrocmp.concat(arrcmp);
	} else {
		var newcmp = arrcmp;
	}
	var cmp = newcmp.toString();
	if (cmp.length == 0) {
		document.location.href = link;
	} else {
		document.location.href = link+"&cmp="+cmp;
	}
	
	} else {
		document.location.href = link;
	}
}

function compareChecked(link) {
	var ocmp = '{CMP}';
	if (ocmp != 'no') {
		var arrocmp = ocmp.split(",");
	} 
	
	
	var arrcmp = new Array();

	if (document.compare) {
	
	for (var i = 0; i < document.compare.length; i++) {
		if (document.compare.elements[i].checked) {
			var test = 0;
			if (ocmp != 'no') {
				for (var j = 0; j < arrocmp.length; j++) {
					if (arrocmp[j] == document.compare.elements[i].value) test = 1;
				}
			}
			if (test == 0) {
				var pushed = arrcmp.push(document.compare.elements[i].value);
			}
			
		} else {
			if (ocmp != 'no') {
				for (var j = 0; j < arrocmp.length; j++) {
					if (arrocmp[j] == document.compare.elements[i].value) arrocmp.splice(j,1);	
				}
			}
		}
		
	}
	if (ocmp != 'no') {
		var newcmp = arrocmp.concat(arrcmp);
	} else {
		var newcmp = arrcmp;
	}

	if (newcmp.length < 2) {
		alert('You have to check min. 2 monitors'); 
	} else {
		var cmp = newcmp.toString();
		if (cmp.length == 0) {
			document.location.href = link;
		} else {
			document.location.href = link+"&cmp="+cmp;
		}
	}
	
	} else {
		document.location.href = link;
	}
}

function multisimilar() {
	compareChecked('multisimilar.php?');
}

function favadd() {
	pagejump('fav_add.php?');
}

function favdel() {
	pagejump('fav_del.php?');
}

function menujump() {
	var ocmp = '{CMP}';
	if (ocmp != 'no') {
		var arrocmp = ocmp.split(",");
	} 
	
	
	var arrcmp = new Array();

	if (document.compare) {
	
	for (var i = 0; i < document.compare.length; i++) {
		if (document.compare.elements[i].checked) {
			var test = 0;
			if (ocmp != 'no') {
				for (var j = 0; j < arrocmp.length; j++) {
					if (arrocmp[j] == document.compare.elements[i].value) test = 1;
				}
			}
			if (test == 0) {
				var pushed = arrcmp.push(document.compare.elements[i].value);
			}
			
		} else {
			if (ocmp != 'no') {
				for (var j = 0; j < arrocmp.length; j++) {
					if (arrocmp[j] == document.compare.elements[i].value) arrocmp.splice(j,1);	
				}
			}
		}
		
	}
	if (ocmp != 'no') {
		var newcmp = arrocmp.concat(arrcmp);
	} else {
		var newcmp = arrcmp;
	}
	var cmp = newcmp.toString();
	
	} else {
		var cmp = '';
	}
	
	document.browser_menu.cmp.value = cmp;
	document.browser_menu.submit();
}

function openWin(plik,w,h) {
	//var tx, ty;
	//tx = ((screen.width-w)/2)-200;
	//ty = ((screen.height-h)/2)-200;
	//window.open(plik,'newpopup','scrollbars=1,resize=0,top='+tx+',left='+ty+',screenX='+tx+',screenY='+ty+',width=' + w + ',height=' + h);
	window.open(plik,'newpopup','scrollbars=1,resize=0,top=40,left=40,screenX=40,screenY=40,width=' + w + ',height=' + h);
} 

function openWinNS(plik,w,h) {
	//var tx, ty;
	//tx = ((screen.width-w)/2)-200;
	//ty = ((screen.height-h)/2)-200;
	//window.open(plik,'newpopup','scrollbars=0,resize=0,top='+tx+',left='+ty+',screenX='+tx+',screenY='+ty+',width=' + w + ',height=' + h);
	window.open(plik,'newpopup','scrollbars=0,resize=0,top=40,left=40,screenX=40,screenY=40,width=' + w + ',height=' + h);
} 