
var curSelected = null;

function mouseOver(el)
{
 	//alert(el.className);
 	if (curSelected != el){
	 	el.style.backgroundColor = "#BAB8B9";
	 	el.style.cursor = "hand";

	}
	window.status = el.id;
	return true;
}

function mouseOut(el)
{
  	if(curSelected != el){
  		//alert(curSelected + " " + el);
  	  	el.style.backgroundColor = "#989898";
	}
	window.status = '';
	return true;
}

function enableInputs()
{
	var isEnabled = false;
	//alert(document.forms['uploadForm'].audioType.value);
	if (document.forms['uploadForm'].audioType.value != "cst")
		isEnabled = true;
	
	document.forms['uploadForm'].actorName.disabled = isEnabled;
	document.forms['uploadForm'].character.disabled = isEnabled;
	document.forms['uploadForm'].year.disabled = isEnabled;
	document.forms['uploadForm'].month.disabled = isEnabled;
	document.forms['uploadForm'].day.disabled = isEnabled;
}

function mousePress(el)
{
	if(curSelected != null && curSelected != el){
		curSelected.className = "leftNavButton";
		curSelected.style.backgroundColor = "#989898";
	}
  	curSelected = el;
  	el.className = "leftNavButtonSelected";
}

function mouseClick(el)
{
	//alert('dd');
	//el.className = "leftNavButtonSelected";
}

function selectNav()
{
	//alert(curSelected);
	if(curSelected != null)
	{
		curSelected.className = "leftNavButtonSelected";
	}
}

function openWin(page)
{
	var win = window.open(page,"uploadWin","location=no,menubar=no,screenx=50,left=50,screeny=50,top=50,status=no,toolbar=no,width=450,height=280,scrollbars=yes,resizable=yes");
	win.focus();
	return false;
}

function checkBodyForm()
{
    if(document.forms['bodyForm']){
        location = document.forms['bodyForm'].newhref.value;
    }
}

function doOnload()
{
    checkBodyForm();
    selectNav();
}

function back()
{
    var argv = back.arguments;

    // THE NUMBER OF ARGUMENTS PASSED TO THIS FUNCTION
    var argc = argv.length;
    var arg1 = (argc>0)?argv[0]:'';
    window.location = 'ninenet.php?backButtonClick=true&S=' + arg1;
    
}

function scene_details(theUrl) 
{
	reWin = window.open(theUrl,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=620,height=500,top=10,left=200');
}

function view_image(theUrl) 
{
	reWin = window.open(theUrl,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=750,height=700,top=10,left=120');
}

function packUploadFormCheck(theForm)
{
	var index = 0;
	var useTemplateArray = new Array();
	for (var i=0; i < theForm.length; i++) {
	   	var anElement = theForm.elements[i];
       	if (anElement.name.indexOf('useTemplate_') > -1 && (anElement.checked == true)) {
       		var tempArray =anElement.name.split("_");
       		var id = tempArray[1];
       		useTemplateArray.push("object_" + id);
       		useTemplateArray.push("objectSwf_" + id);
       		useTemplateArray.push("objectImg_" + id);
       	}
    }   	
		
    for (i=0; i < theForm.length; i++) {
    	anElement = theForm.elements[i];
    	if (anElement.name.indexOf('object') == -1) continue;
    	
    	var exist = false;
    	for(var j=0;j<useTemplateArray.length;j++) {
    		if(anElement.name == useTemplateArray[j]) {
    			exist = true;
    			break;
    		}
    	}
    	
    	if(exist) continue;
    			
       	if (anElement.name.indexOf('object_') > -1 && (anElement.value == null || anElement.value == "")) {
       		alert("Fla file name can not be empty!");
       		anElement.focus();
    		return false;
       	}
               	
       	if (anElement.name.indexOf('objectImg_') > -1 && (anElement.value == null || anElement.value == "")) {
       		alert("Jpg/Gif/Png file can not be empty!");
       		anElement.focus();
    		return false;
       	}
  	}
}

function mdpUploadFormCheck(theForm)
{
      	for (var i=0; i < theForm.length; i++) {
               	var anElement = theForm.elements[i];
               	if (anElement.name.indexOf('object_') > -1 && (anElement.value == null || anElement.value == "")) {
               		alert("Fla file name can not be empty!");
               		anElement.focus();
   	    		return false;
               	}
               	
               	if (anElement.name.indexOf('objectImg_') > -1 && (anElement.value == null || anElement.value == "")) {
               		alert("Jpg/Gif/Png file can not be empty!");
               		anElement.focus();
   	    		return false;
               	}
      	}
}

function templateUploadFormCheck(theForm)
{
      	for (var i=0; i < theForm.length; i++) {
               	var anElement = theForm.elements[i];
               	if (anElement.name.indexOf('objectFLA') > -1 && (anElement.value == null || anElement.value == "")) {
               		alert("Fla file name can not be empty!");
               		anElement.focus();
   	    			return false;
               	}
               	if (anElement.name.indexOf('objectSWF') > -1 && (anElement.value == null || anElement.value == "")) {
               		alert("Swf thumbnail file can not be empty!");
               		anElement.focus();
   	    			return false;
               	}
               	               	
               	if (anElement.name.indexOf('objectIMG') > -1 && (anElement.value == null || anElement.value == "")) {
               		alert("Jpg/Gif/Png file can not be empty!");
               		anElement.focus();
   	    			return false;
               	}
      	}
}

function editFormCheck(theForm)
{
       if (theForm.fileName2.value == "") {
       		alert("Filename field can not be empty!");
            theForm.fileName2.focus();
   	    	return false;
       	}
		return true;
}
