function submitform() {
  document.myform.submit();
}

/* Embedding them in the Head element
function invokeScript(divid) {
	var scriptObj = divid.getElementsByTagName("SCRIPT");
	var len = scriptObj.length;
	for(var i=0; i<len; i++) {
		var scriptText = scriptObj[i].text;
		var scriptFile = scriptObj[i].src
		var scriptTag = document.createElement("SCRIPT");datestamp > '1/1/2011' and ImageNow = 1 and status = 'Active' order by datestamp
		if ((scriptFile != null) && (scriptFile != "")) {
			scriptTag.src = scriptFile;
		}
		scriptTag.text = scriptText;
		if (!document.getElementsByTagName("HEAD")[0]) {
			document.createElement("HEAD").appendChild(scriptTag)
		} else {
			document.getElementsByTagName("HEAD")[0].appendChild(scriptTag);
		}
	}
}
*/

function invokeScript(divLoc) {
	var obj = divLoc.getElementsByTagName("script");
	var len = obj.length;
	for(var i=0; i<len; i++) {
		eval(obj[i].text);   // execute the scripts.
	}
}

function collapse(divLoc) {
	document.getElementById(divLoc).style.width = 0;
    document.getElementById(divLoc).style.height = 0;
   	document.getElementById(divLoc).style.visibility = "hidden";
}

function reveal(divLoc, wth, hght) {
	document.getElementById(divLoc).style.width = wth;
    document.getElementById(divLoc).style.height = hght;
   	document.getElementById(divLoc).style.visibility = "visible";
}

function clearText(thefield) {
	if (thefield.defaultValue == thefield.value) {
		thefield.value = "";
		thefield.setAttribute("class","filled");
		
	}
}

function replaceText(thefield) {
	if (thefield.value == "") {
		thefield.value = thefield.defaultValue;
		thefield.setAttribute("class","new");
		
	} 
}

function pageFormats(format, wth, hght) {
	if (format == "text") {
		reveal(format, wth, hght);
		collapse("html");
	} else if (format == "html") {
		reveal(format, wth, hght);
		collapse("text");
	}
}
 

function pageCreate(divLoc, wth, hght) {
	if (divLoc == "html") {
		reveal(divLoc, wth, hght);
		collapse("text");
	} else if (divLoc == "text") {
		reveal(divLoc, wth, hght);
		collapse("html");
	}
}

function loadingData(divLoc, wth, hght) {
	loadingHTML = "<img src='resources/loading.html'>";
	document.getElementById(divLoc).innerHTML = loadingHTML;
	document.getElementById(divLoc).style.visibility = "visible";
	document.getElementById(divLoc).style.width = wth;
    document.getElementById(divLoc).style.height = hght;
}

function showStuff(strURL, divLocReveal, divLocCollapse, wth, hght) {
	if (divLocCollapse != "") {
		collapse(divLocCollapse);
	}
	loadingData(divLocReveal, 100, 30);
	revealResponse(strURL, divLocReveal, wth, hght);
}

	
function revealResponse(strURL, divLoc, wth, hght) {   
	loadingData(divLoc, wth, hght);
   	var req = getXMLHTTP(); // fuction to get xmlhttp object
    if (req) {
    	req.onreadystatechange = function() {
      		if (req.readyState == 4) { //data is retrieved from server
       			if (req.status == 200) { // which reprents ok status                    
         			document.getElementById(divLoc).innerHTML = req.responseText;
         			document.getElementById(divLoc).style.visibility = "visible";
         			document.getElementById(divLoc).style.width = wth;
         			document.getElementById(divLoc).style.height = hght;
      			} else { 
         			alert("There was a problem while using XMLHTTP:\n");
      			}
      		}            
     	}        
    
    req.open("GET", strURL, true); //open url using get method
    
    req.send(null);
    
    }
}
