// JavaScript Document

//---------------------------------------------------
//-----Disable Google toolbar - yellow fields -------
//---------------------------------------------------
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }

  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }//-->


//----------------------------------------------

	function setFocus() {
		if (document.forms[0]) {
			for (i = 0; i < document.forms[0].elements.length; i++) {
				if (document.forms[0].elements[i].type != "hidden" &&
					document.forms[0].elements[i].disabled != true) {
	
					document.forms[0].elements[i].focus();
					
					return;
				}
			}
		}	
	}

//----------------------------------------------

function Toggle (id) {
	trElement = document.getElementById(id);
	if (trElement){
		if (trElement.className == 'closed'){
			trElement.className = "open";
		} else {
			trElement.className = "closed";
		}
	}
}



//-----------------------------------------------------
//--- FILE UPLOADS ------------------------------------
//-----------------------------------------------------

function upload(type, rename, field, field_img, dest,width,height,max_size){
	win = window.open("file_upload.php?dest=" + dest + "&field=" + field + "&field_img=" + field_img + "&rename=" + rename + "&type=" + type + "&width=" + width + "&height=" + height + "&max_size=" + max_size,"Upload","width=400,height=210,top=150,left=150");
	win.focus();
}

function changeImage (img1, img2) {
  img = getElementById(img1); 
  img.src = img2
  //return true;
}

function movepic(img_name,img_src) {
	document[img_name].src=img_src;
}

function borrar(img, field) {
	window.open("file_upload.php?borrar=" + img + "&field=" + field,"Borrar","width=366,height=210,top=150,left=150");
}

//-----------------------------------------------------
//-----------------------------------------------------

function ShowCalendar (id) {
	url = '../news/popup_calendar.php?id=' + id;	
	win = window.open (url, 'Calendar', 'top=60,left=60,width=775,height=300,scrollbars=yes');
	win.focus ();
}

function ShowCalendarStatic (id) {
	url = '../news/' + id + '.html';	
	win = window.open (url, 'Calendar', 'top=60,left=60,width=775,height=550,scrollbars=yes');
	win.focus ();
}

function ShowPiano (id, notable) {
	url = '../pianos/popup_piano.php?id=' + id + '&amp;notable=' +notable;	
	win = window.open (url, 'Piano', 'top=60,left=60,width=300,height=345,scrollbars=yes');
	win.focus ();
}

