function g(str){
	if (document.getElementById(str))
		return document.getElementById(str)
	return false;
}

function changeInputValue(el, currvalue, newvalue){
	//alert("-" + currvalue + "-" + newvalue + "-");
	if (currvalue == newvalue)
		el.value = '';
	else
		el.value = newvalue;
}

function confirmDeleteItems(ID) {
  if (confirm("Stergeti produsul cu ID-ul " + ID + "?")) {
    document.location = 'main.php?p=a_items&m=del&id=' + ID;
  }
}

function flipPage(index) {
    document.inForm.inField.value = "indexImage: " + str;
}

function selectedLatest(args) {
	loadSection('latest', args);
}

function validateSearchForm(title, prodcode, mode) {
	if (title.value == 'cauta produse')
		title.value = '';
	if (prodcode.value == 'cod produs')
		prodcode.value = '';
	
	if (mode == 'string') {
		prodcode.value = '';
	}
	else if (mode == 'code') {
		title.value = '';
	}
	g('nav').submit();
}

var win= null;
function popWindow(mypage){

	var myname = 'viewer';
	var w = 550;
	var h = 700;
	var scroll = 'no';
	
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings  ='height='+h+',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='scrollbars='+scroll+',';
		settings +='resizable=no,status=no';
	win = window.open(mypage,myname,settings);
	if (parseInt(navigator.appVersion) >= 4){
		win.window.focus();
	}
}

