//<!--

function toggleDiv(divid){
	var e = document.getElementById(divid);
	if(e.style.display == 'block') {
		e.style.display = 'none';
	} else {
		e.style.display = 'block';
	}
}

function showDiv(divid){
	document.getElementById(divid).style.display = 'block';
}

function hideDiv(divid){
	document.getElementById(divid).style.display = 'none';
}

function enableFileInput(file_ID, status_ID, hidden_ID, currentID, action) {
	currenturl = document.getElementById(currentID).value;
	var toShow = document.getElementById(file_ID);
	var hidden = document.getElementById(hidden_ID);
	var status = document.getElementById(status_ID);
	hidden.value = action;
	switch (action){
		case 0: // upload new
			toShow.disabled = 0;
			status.innerHTML='<span style="color:green">Uploading new</span>';
			break;
		case 1: // remove
			toShow.disabled = 1;
			status.innerHTML='<span style="color:red">Removing Image</span>';
			break;
		case 2: // leave unaltered
			toShow.disabled = 1;
			if (currenturl.length == 0) {
				status.innerHTML=' ';
			}else{
				status.innerHTML='<img src="images/wwd/'+currenturl+'" />';
			}
			break;
	}
}
function disableFileInput(fileID, hiddenID) {
	toShow = document.getElementById(fileID);
	hidden = document.getElementById(hiddenID);
	toShow.disabled = 1;
	hidden.value='remove';
}

function prepareEmpInput(id, name, email, jobtitle, imagefile, edit){
	document.getElementById('emp_id').value = id;
	document.getElementById('emp_name').value = name;
	document.getElementById('emp_email').value = email;
	document.getElementById('emp_jobtitle').value = jobtitle;
	/*document.getElementById('emp_img').value = imagefile;*/
	document.getElementById('emp_edit').value = edit;
}

function selectOption(num){
	var selObj = document.getElementById('case_sectionid');
	selObj.selectedIndex = num;
}

function openHelpWindow(type){
	if (type == 'html'){
		window.open('html_help.php','','scrollbars=yes,menubar=no,height=400,width=400,resizable=yes,toolbar=no,location=no,status=no');
	} else if (type == 'zip'){
		window.open('zip_help.php','','scrollbars=yes,menubar=no,height=400,width=400,resizable=yes,toolbar=no,location=no,status=no');
	} else if (type == 'images'){
		window.open('admin/images.php', '', 'scrollbars=yes,menubar=no,height=400,width=400,resizable=yes,toolbar=no,location=no,status=no');
	}
}

function addslashes(str) {
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\0/g,'\0');
	str=str.replace(/\\\\/g,'\\');
	return str;
}

function gocopy(path){
	outstr = '<img src="' + path + '" alt="image" class="image_include" />';
	document.getElementById('copy_text').value = outstr;
	document.getElementById('copy_hidden').style.display = 'block';
}

//-->