function dynamicForm(uri){
	new Ajax('/CmeWeb/'+uri, {
	method:'get', 	
	update:$('ajaxForm'), 
	evalScripts:true,
	onComplete: function(){
	//alert(document.reporttype.rtype.selectedIndex);
	var inpElmt = new Element('input', {type: 'hidden', value: document.reporttype.rtype.selectedIndex, name:'reportTypeIndx'})
	inpElmt.inject($E('form', $('ajaxForm')));
	
	}
     }).request();
}
			
function reportForm(uri){
	new Ajax('/CmeWeb/'+uri, {
	method:'get', 	
	update:$('ajaxForm'), 
	evalScripts:true,
	onComplete: function(){
	//alert(document.reporttype.rtype.selectedIndex);
	if($E('form', $('ajaxForm'))!=null){
	var inpElmt = new Element('input', {type: 'hidden', value: getFProductInfo("productGroup"), name:'tools'})
	inpElmt.inject($E('form', $('ajaxForm')));
	var inpElmt2 = new Element('input', {type: 'hidden', value: getFProductInfo("productCode"), name:'prodName'})
	inpElmt2.inject($E('form', $('ajaxForm')));
	var inpElmt3 = new Element('input', {type: 'hidden', value: getFProductInfo("foi"), name:'contracttype'})
	inpElmt3.inject($E('form', $('ajaxForm')));
	}
	}
     }).request();
}

function getQueryVariable(variable) {  
	var query = window.location.search.substring(1);  
	var vars = query.split("&");  
	for (var i=0;i<vars.length;i++) {    
	var pair = vars[i].split("=");    
	if (pair[0] == variable) {      return pair[1];    }  
	}   
}


function getProductInfo(variable){
	var field = document.getElementById(variable);
	//alert("varrrr " + filed.value);
	if(field != null)
	return field.value;
	else
	return "";
}
		
function putProductInfo(){
	var productGrpvalue = getProductInfo("assetClass");
	var productGrptoAdd = new Element('input', {type: 'hidden', value: productGrpvalue, name:'tools'})
	productGrptoAdd.inject($E('form', $('ajaxForm')));
	var productvalue = getProductInfo("productCode");
	var producttoAdd = new Element('input', {type: 'hidden', value: productvalue, name:'prodName'})
	producttoAdd.inject($E('form', $('ajaxForm')));
	var foivalue = getProductInfo("foi");
	var foitoAdd = new Element('input', {type: 'hidden', value: foivalue, name:'contracttype'})
	foitoAdd.inject($E('form', $('ajaxForm')));
}

function goEvent(){
	window.open(location.protocol+"//"+location.host+"/CmeWeb/event.dld?"+getInfo('eventform'));
}

function goContact(){
	window.open(location.protocol+ "//" + location.host  + "/CmeWeb/contact.dld?contactname="+getProductInfo("contactname") + "&contactfname=" + getProductInfo("contactfname") +"&contactorg=" + getProductInfo("contactorg") + "&contacttitle=" + getProductInfo("contacttitle")+ "&contactphone=" + getProductInfo("contactphone") + "&contactcphone=" + getProductInfo("contactcphone") + "&contactemail=" + getProductInfo("contactemail"));
}

function reportForm1(uri){
	new Ajax('/CmeWeb/'+uri+"?tools="+getFProductInfo('productGroup')+"&prodName="+getFProductInfo('productCode')+"&contracttype="+getFProductInfo('foi'), {
	method:'get', 	
	update:$('ajaxForm'), 
	evalScripts:true,
	onComplete: function(){
	//alert("form name " + $E('form', $('ajaxForm')));
	if($E('form', $('ajaxForm'))!=null){
	var inpElmt = new Element('input', {type: 'hidden', value: getFProductInfo("productGroup"), name:'tools'})
	inpElmt.inject($E('form', $('ajaxForm')));
	var inpElmt2 = new Element('input', {type: 'hidden', value: getFProductInfo("productCode"), name:'prodName'})
	inpElmt2.inject($E('form', $('ajaxForm')));
	var inpElmt3 = new Element('input', {type: 'hidden', value: getFProductInfo("foi"), name:'contracttype'})
	inpElmt3.inject($E('form', $('ajaxForm')));
	}
	}
     }).request();
}

function getFProductInfo(variable){
	//var field = document.getElementById(variable);
	//alert("varrrr " + field.value);
	var field = document.forms["prodform"].elements[variable].value;
	//alert("inside get " + field);
	if(field != null)
	return field;
	else
	return "";
}

function getInfo(A){var B=eval("document."+A);return($(B).toQueryString());}