function MM_swapImgRestore() { //v2.0
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}

function MM_preloadImages() { //v2.0
	if (document.images) {
		var imgFiles = MM_preloadImages.arguments;
		if (document.preloadArray==null) document.preloadArray = new Array();
			var i = document.preloadArray.length;
			with (document) for (var j=0; j<imgFiles.length; j++) 
			if (imgFiles[j].charAt(0)!="#")	{
			preloadArray[i] = new Image;
			preloadArray[i++].src = imgFiles[j];
		} 
	}
}

function toprint() {
	parent.print();
}

function winopen(template,name,scrollbars,resizable,width,height) {
  	window.open(template, name, "scrollbars=" + scrollbars + ",top=0,left=0,dependent=true,location=0,directories=0,status=1,resizable=" + resizable + ",width=" + width + ",height=" + height);
}

function selectmenu() {
document.location = document.form_selectmenu.category_name.options[document.form_selectmenu.category_name.selectedIndex].value
}


function video(file,video_w,video_h,frame_w,frame_h) {
  window.open("video.php?file=" + file + "&video_w=" + video_w + "&video_h=" + video_h + "&frame_w=" + frame_w + "&frame_h=" + frame_h, "video_56k", "top=100,left=200,scrollbars=no,resizable=yes,width=" + frame_w + ",height=" + frame_h); 
}

/* Video clip setting */

function fWriteWMV(id, w, h, url, controls){
	var wmp7;try{if(window.ActiveXObject){wmp7 = new ActiveXObject("WMPlayer.OCX.7");}else if(window.GeckoActiveXObject){wmp7 = new GeckoActiveXObject("WMPlayer.OCX.7");}} catch(oError){}
	var classID = "CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95";
	var txt = "";
	txt += '<object classid="'+classID+'" id="'+id+'" width="'+w+'" height="'+h+'" type="application/x-oleobject"';
	txt += '<param name="name" value="'+id+'" />';
	txt += '<param name="filename" value="'+url+'" />';
	txt += '<param name="autoStart" value="true" />';
	txt += '<param name="enabled" value="true" />';
	txt += '<param name="uiMode" value="full" />';
	txt += '<param name="mute" value="false" />';
	txt += '<param name="volume" value="1" />';
	txt += '<param name="ShowAudioControls" value="true" />';
	txt += '<param name="ShowStatusBar" value="true" />';
	txt += '<param name="ShowTracker" value="true" />';
	txt += '<param name="ShowDisplay" value="false" />';
	txt += '<param name="fullScreen" value="true" />';
	txt += '<param name="SAMIFileName" value="/videos/homepage.smi" />';
	txt += '<param name="CaptioningID" value="subtitle" />';

	if(!wmp7){ 
		txt += '<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" ';
		txt += 'id="'+id+'embed" name="'+id+'" ';
		txt += 'src="'+url+'" filename="'+url+'" ';

		if ( controls )	{
			txt += 'width="'+w+'" height="'+h+'" autoStart="1" showstatusbar="1" showControls="1" showdisplay="0" showaudiocontrols="0" ></embed>';
		} else {
			txt += 'width="'+w+'" height="'+h+'" autoStart="1" showstatusbar="1" showControls="1" showdisplay="0" showaudiocontrols="0" ></embed>';
		}
	}
	txt += '</object>';
	document.write(txt);
}

function PararTAB(quem) { 
   VerifiqueTAB=false; 
} 

function ChecarTAB() { 
   VerifiqueTAB=true; 
}

VerifiqueTAB=true;
function Mostra(quem, tammax) {
	if ( (quem.value.length == tammax) && (VerifiqueTAB) ) {
		var i=0,j=0, indice=-1;
		for (i=0; i<document.forms.length; i++) {
			for (j=0; j<document.forms[i].elements.length; j++) {
				if (document.forms[i].elements[j].name == quem.name) {
					indice=i;
					break;
				}
			}
			if (indice != -1)
		         break;
		}

		for (i=0; i<=document.forms[indice].elements.length; i++) {
			if (document.forms[indice].elements[i].name == quem.name) {
				while ( (document.forms[indice].elements[(i+1)].type == "hidden") &&
						(i < document.forms[indice].elements.length) ) {
							i++;
				}
				document.forms[indice].elements[(i+1)].focus();
				VerifiqueTAB=false;
				break;
			}
		}
	}
}

