function notregistered()
{
    notregistered = window.open('notregistered.htm','Test',"menubar=no,toolbar=no,width=300,height=200,top=200,left=250,scrollbars=no");
}
function showMap(id)
{
    exit=false;
    document.indexform.method="post";
    document.indexform.action=id+".php";
    document.indexform.submit();
}
function showCity(id)
{
    exit=false;
    document.indexform.method="post";
    document.indexform.action=id+"/cities.php";
    document.indexform.submit();
}

function validate(name,id)
{
exit=false;
document.indexform.profileid.value = id;
indexform.method="post";
indexform.action="industrial-directory/profile.php?Company="+name;
indexform.submit();
}

function findPopular(val)
{
    indexform.find.value = val.replace("_"," ");
    indexform.action="industrial-directory/directory-search.php?search=" + val.replace("_"," ");
    indexform.submit();
}
function submitfrm1() {
	document.frmForum.username.value=document.indexform.username1.value;
	document.frmForum.password.value=document.indexform.password1.value;
	document.frmForum.submit();
	return true;
}
function submitfrm2() {
	document.frmForum.username.value=document.indexform.username2.value;
	document.frmForum.password.value=document.indexform.password2.value;
	document.frmForum.submit();
	return true;
}

function callkey()
{
    if(event.keyCode==13)
    {
        gotologin();
    }
}

function callsearchkey()
{
    //document.indexform.MyValue.value = document.indexform.find.value;
    //document.indexform.MyValue1.value = document.indexform.find.value;
    //alert("HI");
    if(event.keyCode==13)
    {
    find();
    }

}

function callLink(aaa)
{

	if(aaa=='1')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://www.google.com/search?hl=en&ie=ISO-8859-1&q=" + document.indexform.MyValue.value);
		}
		else
		{
			window.open("http://www.google.com/");
		}
	}
	else if(aaa=='2')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://search.yahoo.com/search?p=" + document.indexform.MyValue.value + "&ei=UTF-8&fr=fp-tab-web-t&cop=mss&tab=");
		}
		else
		{
			window.open("http://www.yahoo.com/");
		}
	}
	else if(aaa=='3')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://search.msn.com/pass/results.asp?RS=CHECKED&FORM=MSNHM1&v=1&q=" + document.indexform.MyValue.value);
		}
		else
		{
			window.open("http://www.msn.com/");
		}
	}
	else if(aaa=='4')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://www.altavista.com/web/results?q=" + document.indexform.MyValue.value + "&kgs=0&kls=1&avkw=aapt");
		}
		else
		{
			window.open("http://www.altavista.com/");
		}
	}
	else if(aaa=='5')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://search.looksmart.com/p/search?tb=dir&qt=" + document.indexform.MyValue.value);
		}
		else
		{
			window.open("http://www.looksmart.com/");
		}
	}
	else if(aaa=='6')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://search.lycos.com/default.asp?lpv=1&loc=searchhp&tab=web&query=" + document.indexform.MyValue.value);
		}
		else
		{
			window.open("http://www.lycos.com/");
		}
	}
	else if(aaa=='7')
	{
		if (document.indexform.MyValue.value != "")
		{
			window.open("http://msxml.excite.com/info.xcite/search/web/" + document.indexform.MyValue.value);
		}
		else
		{
			window.open("http://www.excite.com/");
		}
	}

}

function gotologin()
{
  if(indexform.loginuser.value=="")
 {
    alert("Please enter the user name");
    indexform.loginuser.focus();
    return;
 }
 if(indexform.loginpass.value=="")
 {
    alert("Please enter a password");
    indexform.loginpass.focus();
    return;
 }
 indexform.action = "login.php";
 indexform.submit();
}
function find()
{
    //alert("hi1");
    if(indexform.find.value=="")
    {
        alert("Please enter a text to find");
        indexform.find.focus();
        return;
    }
    indexform.action="industrial-directory/directory-search.php?Search="+indexform.find.value;
    indexform.submit();
}
function fgotpassword()
{
fgotpass = window.open('fgotpassword.htm','',"menubar=no,toolbar=no,width=300,height=200,top=200,left=250,scrollbars=no");
}

function gotosearch(thisurl,thisname,thisid)
{
indexform.method="post";
indexform.action=thisurl;
indexform.username.value = "<?php print $HTTP_SESSION_VARS['user'];?>";
indexform.usertype.value = "<?php print $HTTP_SESSION_VARS['usrtype'];?>";
indexform.id.value = thisid;
indexform.category.value = thisname;
indexform.submit();

}

function GetAffilate(affil)
{
	//alert(affil);
	document.indexform.method = "post";
	//document.indexform.action = "cleaning-supplies/" + document.indexform.catdrop.value + ".php";
	document.indexform.action = "cleaning-supplies/" + affil + ".php";
	document.indexform.category.value = document.indexform.catdrop.value;
	document.indexform.submit();
}

function GetIndustries(affil)
{
	//alert(affil);
	//return;
	document.indexform.method = "post";
	document.indexform.action = affil; //+ ".php";
	document.indexform.category.value = affil;
	document.indexform.submit();
}

var expDays = 1; // number of days the cookie should last
var popupEvents = 1; // number of times the cookie popsup before expiring
var page = "nwsub.php";
var windowprops = "width=338,height=300,top=150,left=231,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";
var exit=true;
function GetCookie (name)
{
 var arg = name + "=";
 var alen = arg.length;
 var clen = document.cookie.length;
 var i = 0;
 while (i < clen)
  {
   var j = i + alen;
   if (document.cookie.substring(i, j) == arg)
   return getCookieVal (j);
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break;
  }
 return null;
}

function SetCookie (name, value)
{
 var argv = SetCookie.arguments;
 var argc = SetCookie.arguments.length;
 var expires = (argc > 2) ? argv[2] : null;
 var path = (argc > 3) ? argv[3] : null;
 var domain = (argc > 4) ? argv[4] : null;
 var secure = (argc > 5) ? argv[5] : false;
 document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name)
{
 var exp = new Date();
 exp.setTime (exp.getTime() - 1);
 var cval = GetCookie (name);
 document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
 var exp = new Date();
 exp.setTime(exp.getTime() + (expDays*1*60*60*1000));

function amt()
{
 var count = GetCookie('count')
 if(count == null)
  {
   SetCookie('count','1')
   return 1
  }
 else {
  var newcount = parseInt(count) + 1;
  DeleteCookie('count')
  SetCookie('count',newcount,exp)
  return count
  }
}
function getCookieVal(offset)
{
 var endstr = document.cookie.indexOf (";", offset);
 if (endstr == -1)
  endstr = document.cookie.length;
 return unescape(document.cookie.substring(offset, endstr));
}

function checkCount(loginuser)
{
/*    if((loginuser != "")&&(loginuser != "undefined"))
    {
           exit = false;
    }

    var logedin = "<?php print $n?>";
    if(logedin > 0)
    {
        exit = false;
    }*/

var count = GetCookie('count');
//alert("Exit value :" + exit);
if(exit == "test")
{
exit = true;
count = null;
}

if(exit == true)
{
	if (count == null)
	{
        SetCookie('count', count, exp);
		window.open(page, "", windowprops);
	}
	else
	{
		count++;
		SetCookie('count', count, exp);
	}
}
}




function boldAdvise(src,text) { src.title=text; return; }
