
var compQueryText = null;

/* this function can be used as common function for all the three approaches defined below */
	function submitSearchByProduct(formName ){
		var myform = document.forms[formName];
		var SelectedAsset = "";
		var SelectedSubAsset = "";
		var QueryText = "";
		var compQueryText = "";
		var BaseFormUrl = "";	
		var zeroElem = "";
		var subAction = "&";
		
		if(myform.selectedAsset){
			SelectedAsset = myform.selectedAsset.value;
		}

		if(myform.zeroElem){
			zeroElem = myform.zeroElem.value;
		}

		if(myform.selectedSubAsset){
			if(zeroElem!=null && zeroElem!=""){
				/* need to consider 0th elem in case of subasset*/
				if(myform.selectedSubAsset.selectedIndex >= 0)
					SelectedSubAsset = myform.selectedSubAsset.value;
			}else{
				if(myform.selectedSubAsset.selectedIndex > 0)
					SelectedSubAsset = myform.selectedSubAsset.value;
			}
		}

		/* add find by Product query text to action */
		/* if both query text and find by product are present priority is given to find by product*/

		if(myform.FindByProductQueryText){
			compQueryText = myform.FindByProductQueryText.value;
					/* add find by Product query text to action */
			if(compQueryText ==null || compQueryText == 'Enter Product Code' )
				compQueryText = "";

		}else if(myform.queryText){
			QueryText = myform.queryText.value;
					/* add find by Product query text to action */
			/** modified by b17090 CCT70835 start**/
			if(QueryText ==null || QueryText == 'Enter Keyword' )
				QueryText = "* ";
			/** modified by b17090 CCT70835 end**/
			}
		
		if (compQueryText !="") 
			subAction = subAction + 'QueryText='+compQueryText + '&';

		if(myform.base_form_url){
			BaseFormUrl = myform.base_form_url.value;
		}

		if (QueryText!="") 
			subAction = subAction + 'QueryText='+QueryText + '&';
			
		/* add asset selection to action */	
		if (SelectedAsset !="") 
			subAction=subAction + 'SelectedAsset='+SelectedAsset + '&';	
		
		/* add sub asset selection to action, if present */	
		if ((SelectedAsset !="") && (SelectedSubAsset !="") )
			subAction=subAction+SelectedAsset+'='+SelectedAsset+SelectedSubAsset + '&';	
		
		if(BaseFormUrl!=null && BaseFormUrl!=""){
			/* need to appaned fsrch=1 , always*/
			myform.action= BaseFormUrl + subAction+'&fsrch=1';
		}else{
			/* need to appaned fsrch=1 , always*/
			myform.action= myform.action + subAction+'&fsrch=1';
		}
		/** modified by b17090 CCT70835 start**/
		var att=document.getElementById("keyHeader").value;
		att=parseInt(att);
		att=att+1;
		myform.action= myform.action + '&attempt='+att;
		/** modified by b17090 CCT70835 end**/
		myform.submit();
	}