
function PrepopulateStandardForm()
{
	
	strUrl = window.location.href;
	if(strUrl.lastIndexOf("wcs01") > -1)
	{
		strQueryStringStart = "wcs01"	
		strVariableStart = "/"
	} else {
		strQueryStringStart = "?"
		strVariableStart = "&"		
	}

	var temp = new Array();
	temp = strUrl.split(strQueryStringStart);
	var temp1 = new Array();
	if (temp.length == 1)
		temp1 = temp[0].split(strVariableStart);
	else
		temp1 = temp[1].split(strVariableStart);
	for (i=0; i<temp1.length; i++)
	{
		var temp3 = new Array();
		temp3 = temp1[i].split('=');

		if(temp3[0].lastIndexOf("Input") > -1)
		{
			var field = eval("document.all." + temp3[0])
			if(field)
			{
				var fieldType = field.type
				if ((fieldType == 'text') || (fieldType == 'textarea') || (fieldType == 'hidden')) {
					field.value = temp3[1]
				}
				// Check box
				if (fieldType == 'checkbox') {
					if (field.value == temp3[1]) {
						field.checked = true;
				}	}
				// List field
				if (fieldType == 'select-one') {
					for (selectIndex=0; selectIndex < field.length; selectIndex++) {
						if (field[selectIndex].text == temp3[1]) {
							field[selectIndex].selected = true;
				}	}	}	

				//Radio buttons
				if (field.length) {
					if (field.length > 0) {
						for (selectIndex=0; selectIndex < field.length; selectIndex++) {
							if(field[selectIndex].type == 'radio')
							{
								if(field[selectIndex].value == temp3[1])
								{
									field[selectIndex].checked = true;
								}
							}
						}
					}
				}
			}
		}
	}
}

if (window.location.href.lastIndexOf("Input") > -1)
{
	PrepopulateStandardForm()
}

function GetQueryString2(key)
{
	strUrl = "" + window.location;
	var temp = new Array();
	temp = strUrl.split('/');
	for (i=0; i<temp.length; i++)
	{
		var temp3 = new Array();
		temp3 = temp[i].split('=');
		if (temp3.length == 2 && temp3[0] == key)
		{
			return temp3[1];
		}
	}
}


