<!--

/* ECN JavaScript */

function trim(stringToTrim)
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function checkForm(x)
{
	var check = true;
	for (i=0; i<x.length-1; i++) {
		if (trim(document.getElementById(x[i]).value) == "") {
			check = false;
			break;
		}
	}

	if (check) 
		return true;
	else {
		alert("Please complete all the mandatory fields before publishing !!");
		return false;
	}
}

extArray = new Array(".flv");
function limitAttach(form, file)
{
        allowSubmit = false;
	if (!file) return;
	while (file.indexOf("\\") != -1)
	    file = file.slice(file.indexOf("\\") + 1);
	    ext = file.slice(file.indexOf(".")).toLowerCase();
	    for (var i = 0; i < extArray.length; i++) {
	        if (extArray[i] == ext) {
			allowSubmit = true;
			break;
		}
	    }
	    if (allowSubmit) 
	    	return true;
	    else
		alert("Please only upload files that end in types:  "
		       + (extArray.join("  ")) + "\nPlease select a new "
		       + "file to upload and submit again.");
	return false;
}

function projectFormNav(x,y)
{
	var tc = new Array('t1','c1','c2','c3','c4','c5','c6',
			  't2','c7',
			  't3','c8',
			  't4','c9',
			  't5','c10',
			  't6','c11',
			  't7','c12','c13','c14','c15',
			  't8','c16','c17','c18',
			  't9','c19');
	var xx = new Array('',
			   't1,c1,c2,c3,c4,c5,c6',
			   't2,c7',
			   't3,c8',
			   't4,c9',
			   't5,c10',
			   't6,c11',
			   't7,c12,c13,c14,c15',
			   't8,c16,c17,c18',
			   't9,c19');

	if (x == -1) 
		for (i=1; i<=9; i++)
			if (document.getElementById('a'+i).style.fontWeight == 'bold') {
				if (y == 'prev')
					if (i == 1)
						x = 1;
					else 
						x = i-1;
				if (y == 'next')
					if (i == 9)
						x = 9;
					else
						x = i+1;
				break;
			}

	var xxx = xx[x].split(',');

	for (i=0; i<tc.length; i++) {
		display = 'none';
		for (j=0; j<xxx.length; j++)
			if (xxx[j] == tc[i]) {
				display = '';
				break;
			}
		document.getElementById(tc[i]).style.display = display;
	}

	for (k=1; k<=9; k++)
		if (k==x) {
			document.getElementById('a'+k).style.fontWeight = 'bold';
			document.getElementById('b'+k).style.fontWeight = 'bold';
		} else {
			document.getElementById('a'+k).style.fontWeight = 'normal';
			document.getElementById('b'+k).style.fontWeight = 'normal';
		}

	if (y=='') {
		if (x==9)
			document.getElementById('submit').style.display = '';
		else
			document.getElementById('submit').style.display = 'none';
	}
}

function producerFormNav(x,y)
{
        var tc = new Array('t1','c1',
                	   't2','c2','c3',
			   't3','c4','c5',
			   't4','c6','c7',
			   't5','c8','c9',
			   't6','c10','c11',
			   't7','c12','c13',
			   't8','c14','c15');
 	var xx = new Array('',
	                   't1,c1',
	                   't2,c2,c3',
	                   't3,c4,c5',
	                   't4,c6,c7',
	                   't5,c8,c9',
	                   't6,c10,c11',
	                   't7,c12,c13',
	                   't8,c14,c15');
        var xxx = xx[x].split(',');

	for (i=0; i<tc.length; i++) {
		display = 'none';
		for (j=0; j<xxx.length; j++)
			if (xxx[j] == tc[i]) {
				display = '';
				break;
			}
		document.getElementById(tc[i]).style.display = display;
	}

	for (k=1; k<=8; k++)
		if (k==x) {
			document.getElementById('a'+k).style.fontWeight = 'bold';
			document.getElementById('b'+k).style.fontWeight = 'bold';
		} else {
			document.getElementById('a'+k).style.fontWeight = 'normal';
			document.getElementById('b'+k).style.fontWeight = 'normal';
		}

	if (y=='') {
		if (x==8)
			document.getElementById('submit').style.display = '';
		else
			document.getElementById('submit').style.display = 'none';
	}
}

//-->

