/*
	functions.js
*/

// changing input type
function change_input_type(oldObject, oType)
{
	var newObject = document.createElement('input');
	newObject.type = oType;

	if(oldObject.size) newObject.size = oldObject.size;
	if(oldObject.value) newObject.value = oldObject.value;
	if(oldObject.name) newObject.name = oldObject.name;
	if(oldObject.maxlength) newObject.maxlength = oldObject.maxlength;
	if(oldObject.id) newObject.id = oldObject.id;
	if(oldObject.className) newObject.className = oldObject.className;	
	oldObject.parentNode.replaceChild(newObject,oldObject);		
	newObject.value='';
	newObject.focus();
	document.getElementById('password').focus();
	return newObject;
}

// redirect page
function redirect_to (location)
{
	window.location.href = location;
}

function change_security_image ()
{
	iframe = document.getElementById('captcha');
	if (!iframe) return false;
	iframe.src = iframe.src;
}

function confirmDelete (delUrl)
{
	if (confirm("Are you sure you want to delete this record?"))
		document.location = delUrl;
}


function forcedownload (iframeId, fileloc, url)
{
	var iframe = document.getElementById(iframeId)
	iframe.src = url + "/forcedownload.php?file=" + fileloc;
}

function forcedownload2 ()
{
	alert("hi");
}
