
var p = 1;
function google_ad_request_done(google_ads){
var s='';
var i;
if(google_ads.length==0){
return;
}
if(google_ads[0].type=="text"){
if(google_ads.length==1){
 s += '<a href=\"' + google_info.feedback_url + '\" style="color:#000000; font-size:12px;font-family:arial; float:left; padding-left:1px;text-decoration:none;">Ads by Google</a><br>'

   s += '<DIV class="gdt" style="margin-top:4px"><a href="' +
google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
google_ads[i].visible_url + '\';return true"> <span> <b>' +
google_ads[i].line1 + '</b></span></a> - <span class="gar"><a href="' +
google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
google_ads[i].visible_url + '\';return true">' +
google_ads[i].visible_url + '</span></a></DIV><div style="border-bottom:1px dashed #e8e7e7;color:#000;font-size:12px;margin:5px 0 3px;padding-bottom:8px;font-family:"Trebuchet MS", Arial;letter-spacing:2px;">' +
google_ads[i].line2 + '' +
google_ads[i].line3 + '</div>';

} else if (google_ads.length > 1) 
	
{ s += '<a href=\"' + google_info.feedback_url + '\" style="color:#000000; font-size:12px;font-family:arial; float:left; padding-left:1px;text-decoration:none;">Ads by Google</a><br>'



for(i = 0; i < google_ads.length; ++i) {

s += '<DIV class="gdt" style="margin-top:4px"><a href="' +
google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
google_ads[i].visible_url + '\';return true"> <span> <b>' +
google_ads[i].line1 + '</b></span></a> - <span class="gar"><a href="' +
google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
google_ads[i].visible_url + '\';return true">' +
google_ads[i].visible_url + '</span></a></DIV><div style="border-bottom:1px dashed #e8e7e7;color:#000;font-size:12px;margin:5px 0 3px;padding-bottom:8px;font-family:"Trebuchet MS", Arial;letter-spacing:2px;">' +
google_ads[i].line2 + '' +
google_ads[i].line3 + '</div>';
}
if (google_ads[0].bidtype == "CPC") { /* insert this snippet for each ad call */ 
google_adnum = google_adnum + google_ads.length;
}
}
  }

    document.write(s);
    return;
  }
function callgoogle()
{
google_ad_client = 'pub-0673059417528889';
google_ad_output='js';
google_max_num_ads=ads_count;
google_ad_type='text';
google_feedback='on';
google_skip=google_adnum;
}





/*******************************************/
function CheckDataSearch(Form)
{
	var re = /(Enter\s+.*?Search)/i;

	if (Form.ss.value.match( re ))
	{	
		var found = Form.ss.value.replace('...', ' ');
		found = found.replace(/\s+$/g, '');
		alert('Please ' + found + '.');
		Form.ss.focus();
		return false;
	}
	Form.ss.value = Form.ss.value.replace(/[^a-zA-Z0-9 ]/g, ' ');
	Form.ss.value = Form.ss.value.replace(/^\s+/g, '').replace(/\s+$/g, '');
	while(Form.ss.value.indexOf('  ')>0){
		Form.ss.value = Form.ss.value.replace('  ',' ');
	}
	
	var temp=Form.ss.value.replace(/\s/g, '');
	if (temp.length < 3){
		alert("Enter at least three characters for search.");
		Form.ss.focus();
		return false;
	}
	else
	{
		var str = Form.ss.value.replace(/\s/g, '+');
		if(Form.searchfor.value == "comp"){
			str ='ss='+escape(str);
			str = "http://dir.indiamart.com/cgi/compcatsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "product"){
			str ='ss='+escape(str);
			str = "http://catalogs.indiamart.com/cgi/catprdsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "offer"){
			Form.search.value = str;
 			str ='search='+escape(str);
 			str = myReplace(str,"\\\\?\\\\&","?");
			Form.action = "http://trade.indiamart.com/search.mp?"+str;
			Form.submit();
			return false;
                }
		else if(Form.searchfor.value == "tenders"){
			str ='ss='+escape(str);
			str = "http://tenders.indiamart.com/search.cgi?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
		}
		else if(Form.searchfor.value == "leads"){
			Form.search.value = str;

			var dispType = document.createElement('INPUT');
			dispType.setAttribute('name', 'disp');
			dispType.setAttribute('value', 'B');
			dispType.setAttribute('type', 'hidden');
			Form.appendChild(dispType); 
			
 			str ='search='+escape(str);
 			str = myReplace(str,"\\\\?\\\\&","?");
			Form.action = "http://trade.indiamart.com/search.mp?"+str;
			Form.submit();
			return false;
		}
	}
}

function myReplace(str, a, b) {
        var re = new RegExp(a, "g");
        var ret = str.replace(re,b);
        return ret;
}

function srchb()
{
	var option = document.searchForm.searchfor;
	var field = document.searchForm.ss;

	if(option.value == "comp")
	{
		if (field.value=='Enter Product / Company Name to Search ...')
		{
			field.value = '';
			field.style.color = "#000000";
		}
		else if (field.value=='')
		{
			field.value = 'Enter Product / Company Name to Search ...';
			field.style.color = "#626262";
		}
	}
	else if(option.value == "product")
	{
		if (field.value=='Enter Product / Company Name to Search ...')
		{
			field.value = '';
			field.style.color = "#000000";
		}
		else if (field.value=='')
		{
			field.value = 'Enter Product / Company Name to Search ...';
			field.style.color = "#626262";
		}
	}
	else if(option.value == "tenders")
	{
		if (field.value=='Enter keyword / company name to search preferred tenders ...')
		{
			field.value = '';
			field.style.color = "#000000";
		}
		else if (field.value=='')
		{
			field.value = 'Enter keyword / company name to search preferred tenders ...';
			field.style.color = "#626262";
		}
	}
	else if(option.value == "offer")
	{
		if (field.value=='Enter Product / Service Offers to Search ...')
		{
			field.value = '';
			field.style.color = "#000000";
		}
		else if (field.value=='')
		{
			field.value = 'Enter Product / Service Offers to Search ...';
			field.style.color = "#626262";
		}
	}
	else if(option.value == "leads")
	{
		if (field.value=='Enter Product / Service Buy Leads to Search ...')
		{
			field.value = '';
			field.style.color = "#000000";
		}
		else if (field.value=='')
		{
			field.value = 'Enter Product / Service Buy Leads to Search ...';
			field.style.color = "#626262";
		}
	}
}



function searchCaption(Form)
{
	var re = /(Enter\s+.*?Search)/i;

	if(Form.searchfor.value == "comp" && Form.ss.value.match( re ))
	{
		Form.ss.value = 'Enter Product / Company Name to Search ...';	
		return false;
	}
	else if(Form.searchfor.value == "product" && Form.ss.value.match( re ))
	{
		Form.ss.value = 'Enter Product / Company Name to Search ...';	
		return false;
	}
	else if(Form.searchfor.value == "tenders" && Form.ss.value.match( re ))
	{
		Form.ss.value = 'Enter keyword / company name to search preferred tenders ...';	
		return false;
	}
	else if(Form.searchfor.value == "offer" && Form.ss.value.match( re ))
	{
		Form.ss.value = 'Enter Product / Service Offers to Search ...';	
		return false;
	}
	else if(Form.searchfor.value == "leads" && Form.ss.value.match( re ))
	{
		Form.ss.value = 'Enter Product / Service Buy Leads to Search ...';	
		return false;
	}
}	
/***********************************************************************/
var persistmenu="yes"
var persisttype="sitewide"
if(document.getElementById){document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')}
function SwitchMenu(obj)
{if(document.getElementById)
{var el=document.getElementById(obj);var ar=document.getElementById("masterdiv").getElementsByTagName("div");if(el.style.display!="block")
{for(var i=0;i<ar.length;i++)
{if(ar[i].className=="submenu")
ar[i].style.display="none";}
el.style.display="block";}}}
var persistmenu="yes"
var persisttype="sitewide"
if(document.getElementById){document.write('<style type="text/css">\n')
document.write('.subtab{display: none;}\n')
document.write('</style>\n')}
function SwitchTab(obj)
{if(document.getElementById)
{var ea=document.getElementById(obj);var ae=document.getElementById("commondiv").getElementsByTagName("div");if(ea.style.display!="block")
{for(var i=0;i<ae.length;i++)
{if(ae[i].className=="subtab")
ae[i].style.display="none";}
ea.style.display="block";}}}
function trade_tab1()
{document.getElementById("fair2").className="t_fair1";document.getElementById("fair1").className="t_fair";}
function trade_tab2()
{document.getElementById("fair2").className="t_fair";document.getElementById("fair1").className="t_fair1";}

