
function doCountryDocumentsSearch(strActionURL)
{ 
	var countryCodeVal ;
	if(strActionURL == '')
		{
		currentURL = document.searchformProjectCntryReports.chooseSite.options[document.searchformProjectCntryReports.chooseSite.selectedIndex].value;
		}
	else
		{
		currentURL = strActionURL ;
		}
	var url=currentURL;
	var urlFirstPart;
	var urlSecondPart;
	var targetURL;
	var urlAppend;
	var urlAppendcntry;

	countryCodeVal=
		document.searchformProjectCntryReports.chooseCountry.options[document.searchformProjectCntryReports.chooseCountry.selectedIndex].value;
	if(countryCodeVal =='')
	{
		alert('Please select a Country')
	}
	
	if(countryCodeVal != '')
	{
		// Start of JIRA: WID-1030 Author:Mohamed Anvar Date:07-May-2008 Change : Code added to pass countryMDk in request instead of country code 
		var countryMDK;
		if(countryCodeVal.indexOf(',') != -1)
		{
			countryMDK= countryCodeVal.substring(countryCodeVal.indexOf(',')+1);
		}
		else
		{
			countryMDK= countryCodeVal;	
		}
		countryCodeVal = countryCodeVal.substring(0,2);
		//End of JIRA: WID-1030
		if(url.indexOf(',00.html') != -1)
		{
		urlFirstPart=url.substring(0,url.indexOf('0,,')+3);
		urlSecondPart=url.substring(url.indexOf('0,,')+3);
		//JIRA: WID-1030 Author:Mohamed Anvar Date:07-May-2008 Change : Code added to pass countryMDk in request instead of country code 
		urlAppend="countrycode:"+countryCodeVal;urlAppend=urlAppend+'~';	urlAppendcntry="cntry:"+countryMDK;
		//End of JIRA: WID-1030
		if(urlSecondPart.length!=0)
				urlAppendcntry=urlAppendcntry+'~';
				targetURL=urlFirstPart+urlAppend+urlAppendcntry+urlSecondPart;
		}
		else
		{
		urlFirstPart=url.substring(0,url.indexOf('?')+1);
		urlSecondPart=url.substring(url.indexOf('?')+1);
		//JIRA: WID-1030 Author:Mohamed Anvar Date:07-May-2008 Change : Code added to pass countryMDk in request instead of country code 
		urlAppend="countrycode="+countryCodeVal;urlAppend=urlAppend+'&';	urlAppendcntry="cntry="+countryMDK;
		//End of JIRA: WID-1030
		if(urlSecondPart.length!=0)
				urlAppendcntry=urlAppendcntry+'&';
				targetURL=urlFirstPart+urlAppend+urlAppendcntry+urlSecondPart;
		}
		window.location.href=targetURL;																				
	}
}

