function MM_openBrWindow(theURL, winName, myWidth, myHeight) //my Version
{ 
	var features ='';
	if (window.screen)
	{
		var myLeft=(window.screen.width-myWidth)/2;
		var myTop=(window.screen.height-myHeight)/2;
		
		features+='left='+myLeft+',top='+myTop;
		features+=',width='+myWidth+',height='+myHeight;
		features+=',TOOLBAR=no,LOCATION=no,DIRECTORIES=no,STATUS=no,MENUBAR=no,SCROLLBARS=yes,RESIZABLE=no';
		
		window.open(theURL, winName, features);
	}
}


function showHide(id) {
	var divID = document.getElementById(id);

	if (divID.style.display == 'none') {
		divID.style.display = 'block';
	}
	else {
		divID.style.display = 'none';	
	}
}

function next() {
    var now = new Date();
    var newSrc = '../jcaptcha?' + now.getTime();
    if (document.images) {
        document.images.captcha.src = newSrc;
    }
}

var firstCell;
var secondCell; //save properties for later use

function changeFile(strMaximumSize, rowId, inputName, form)
{
	// 130x130pixels for companies
	// 59x78px for people (small)
	// 100x125px for people (big)
	var rowcells = document.getElementById(rowId).cells;
	
	firstCell = rowcells[0].innerHTML;
	secondCell = rowcells[1].innerHTML;
	var imageLabel = "Image:";
	if(form == 'people') {
		if(inputName == 'upload2') {
			imageLabel = "Full size:";
		}	
		else {
			imageLabel = "Thumbnail:";
		}
	}
	
	rowcells[0].innerHTML = "<td style='vertical-align: top;'>*&nbsp;" + imageLabel + "</td>";
	rowcells[1].innerHTML = "<td colspan='2'>";
	rowcells[1].innerHTML += "<input type='file' name='" + inputName + "' value='' id='companyform_save_upload' style='width: 220px;height: 20px;'/>";
	rowcells[1].innerHTML += "<br />";
	rowcells[1].innerHTML += "Maximum image size: " + strMaximumSize + ".";
	rowcells[1].innerHTML += "<input type='button' value='Cancel' " +
			"onclick=\"back('" + rowId + "\')\"/>";
	rowcells[1].innerHTML += "</td>";	
}

function back(rowId)
{
	var rowcells = document.getElementById(rowId).cells;
	
	rowcells[0].innerHTML = firstCell;
	rowcells[1].innerHTML = secondCell;
}

function updateNewsForm()
{
	if($("#radioExternal").attr("checked") == true) {
		//Link is required
		$(".newsLinkRow").show();
		$(".newsStoryRow").hide();
		$("#isExternal").val("true");
	}
	else {
		$(".newsLinkRow").hide();
		$(".newsStoryRow").show();
		$("#isExternal").val("false");
	}
}

function initializeNewsForm()
{
	if($("#isExternal").val() == "true") {
		$("#radioExternal").attr("checked", true);
	}
	else {
		$("#radioInternal").attr("checked", true);
	}
	updateNewsForm();
}
