function selectGaleria(method,galeria) {
		var f = createForm(method,"","f1" );
		f.appendChild(createHidden("gal",galeria));
		document.getElementsByTagName("body")[0].appendChild(f);
		f.submit();
}

function selectPicture(gal, pic, method) {
		var f = createForm(method, "", "f1");
		f.appendChild(createHidden("gal", gal));
		f.appendChild(createHidden("pic", pic));
		document.getElementsByTagName("body")[0].appendChild(f);
		f.submit();
}

function chooseComboByValue(combo_id,value) {
		var combo = document.getElementById(combo_id);
		if (combo!=null)
		{
				var i=0;
				while(combo.options[i].value!=value && i<combo.options.length) i++;
				combo.selectedIndex=i;
		}
}

function createForm(method, action, id) {
	var f = document.createElement("form");
	f.method=method;
	f.action="";
	f.style.display="none";
	f.id = id;
	return f;
}

function createHidden(name, value) {
	var i = document.createElement("input");
	i.type="hidden";
	i.name =name;
	i.id =name;
	i.value = value;
	return i;
}

function createTextInput(name, value) {
	var i = document.createElement("input");
	i.type="text";
	i.id = name;
	i.name =name;
	i.value = value;
	return i;
}


function createFile(name, value) {
	var i = document.createElement("input");
	i.type="file";
	i.name =name;
	return i;
}

function openPicture(image_url) {
	openWindow("viewer.php?src="+image_url, 200, 200, 0, 0, 0, 0, 0, 1, (screen.width/2)-100, (screen.height/2-100) );
}


/*
 POPUP WINDOW GENERATOR
 Usage: openWindow( url , w , h , tb , stb , L , mb , sb , rs , x , y )
	# url 	- The URL of the page to open. Example: "http://scriptasylum.com".
	# w 	- The width of the window in pixels.
	# h 	- The height of the window in pixels (doesn't include menubars).
	# tb 	- Toolbar visible? 1 = yes, 0 = no.
	# stb 	- Status bar visible? 1 = yes, 0 = no.
	# L 	- Linkbar visible? 1 = yes, 0 = no.
	# mb 	- Menubar visible? 1 = yes, 0 = no.
	# sb 	- Scrollbars visible? 1 = yes, 0 = no.
	# rs 	- Resizable window? 1 = yes, 0 = no.
	# x 	- The horizontal position of the window from the left of the screen.
	# y 	- The vertical position of the window from the top of the screen.
*/
function openWindow(url,w,h,tb,stb,l,mb,sb,rs,x,y){
var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y;
tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();
}

