
function setCookie(name, value, expire)
{
document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()));
}

function getCookie(Name)
{
var search = Name + "=";
if (document.cookie.length > 0) {
	offset = document.cookie.indexOf(search);
	if (offset != -1) { 
		offset += search.length;
		end = document.cookie.indexOf(";", offset);
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(offset, end));
	}
}
return null;
}

function getName()
{
return getCookie("name");
}

function getUser()
{
return getCookie("user");
}

function getUID()
{
sUID=getCookie("uID");
if (sUID=="0") sUID=null;
return sUID;
}

function getSID()
{
sID=getCookie("sID");
if (sID=="0") sID=null;
return sID;
}

function getCountry()
{
return getCookie("country");
}

function getState()
{
return getCookie("state");
}

function getCity()
{
return getCookie("city");
}

function getStreet()
{
return getCookie("street");
}

function registerCookie(name, value)
{
var today = new Date();
var expires = new Date();
expires.setTime(today.getTime() + 1000*60*60*24*365);
setCookie(name, value, expires);
}

function GetTimeID()
{
  var dt;
  var tID;
  dt = new Date();
  tID = dt.getTime().toString();
  return(tID);
}

function GetNewUID()
{
  var dt, tm;
  var sID;
  dt = new Date();
  tm = new Number(dt.getTime());
  sID = tm.toString().slice(0, -3);
  return(sID);
}

function SetElementValue(objID, objFrm, sValue)
{
  document.forms[objFrm].elements[objID].value=sValue;
}

function SetReferrerPage(objID, objFrm)
{
  document.forms[objFrm].elements[objID].value=escape(document.referrer);
}

function SetnUIDElement(objID, objFrm)
{
  nUID=GetNewUID();
  document.forms[objFrm].elements[objID].value=nUID;
}

function SettIDElement(objID, objFrm)
{
  tID=GetTimeID();
  document.forms[objFrm].elements[objID].value=tID;
//  setCookie("sID", tID);
}

function SettIDElement2(objID, objFrm)
{
  tID=GetTimeID();
  document.forms[objFrm].elements[objID].value=tID;
//  if (getsID()==null) setCookie("sID", tID);
}

function setCity(objList)
{
sIndex=objList.selectedIndex;
sValue=objList.options[sIndex].value;
document.cookie = "city=" + sValue + ";path=/;";
}

function setCountry(objList)
{
sIndex=objList.selectedIndex;
sValue=objList.options[sIndex].value;
document.cookie = "country=" + sValue + ";path=/;";
document.cookie = "city=ALL;path=/;";
}

function setStreet(objList)
{
sIndex=objList.selectedIndex;
sValue=objList.options[sIndex].value;
document.cookie = "street=" + sValue + ";path=/;";
document.cookie = "category=ALL;path=/;";
}

function selectCountry(objList)
{
setCountry(objList);
document.location.reload(true);
}

function selectStreet(objList)
{
setStreet(objList);
document.location.reload(true);
}

function setSelectedItem(objID, objFrm, sValue)
{
objList=document.forms[objFrm].elements[objID];
if (objList==null) return;

for (var i = 0; i < objList.options.length; i++) {
   if (objList.options[i].value==sValue)
	   objList.options[i].selected = true;
}

//document.forms[objFrm].elements[objID].value=sValue;
}

function setChecked(objID, objFrm, sValue)
{
objList=document.forms[objFrm].elements[objID];
if (objList==null) return;
objList.checked=sValue;
}

function setCheckedItem(objID, objFrm, sValue)
{
objList=document.forms[objFrm].elements[objID];
if (objList==null) return;

for (var i = 0; i < objList.length; i++) {
   if (objList[i].value==sValue)
	   objList[i].checked = true;
}

}

function gotoCountryPage(sCountryCode, objFrm)
{
document.cookie = "country=" + sCountryCode + ";path=/;";
document.forms[objFrm].submit();
}

function gotoServicePage(sServicePage)
{
UserID=getUID();
if (UserID!=null) {
	document.location.replace(sServicePage);
}
}

function drawJumpMenu(iJumpClass)
{
sCountry=getCountry();
sStreet=getStreet();
if (sCountry==null) sCountry="US";
if (sStreet==null) sStreet="S";

var HTMLStr = "<!-- QUICK SHOP -->"

	+ "<tr valign=middle>"
	+ "<td width='470' HEIGHT='40' colspan='2' valign=middle align=center>"
	+ "<form action='./jumpto.asp' method='get' id='frmcountry' name='frmcountry'>"
	+ "<table width='165' height=20  cellspacing='0' cellpadding='0' border='0' align='right'>"

	+ "<tr>"
	+ "<td width='165' height=16 align='right' valign='bottom'>"
	+ "<img alt='Select Street' height='21' src='./images/iselection.gif' width='82'></td>"

	+ "<td valign='bottom'>"
	+ "<input type=hidden name=page value=Street>"
	+ "<select class='SelectBox1' name='country' id='country' onchange='setCountry(this);'>"
//	+ "<option value='AA' selected>&nbsp;International"
	+ "<option value='AU'>&nbsp;Australia"
	+ "<option value='CA'>&nbsp;Canada"
	+ "<option value='DE'>&nbsp;Germany"
	+ "<option value='IN'>&nbsp;India"
	+ "<option value='JM'>&nbsp;Jamaica"
	+ "<option value='JP'>&nbsp;Japan"
	+ "<option value='NZ'>&nbsp;New Zealand"
	+ "<option value='GB'>&nbsp;United Kingdom"
	+ "<option value='US' selected>&nbsp;United States"
 + "</select>"
	+ "</td>"

	+ "<td valign='bottom'>"
	+ "<select class='SelectBox1' name='street' id='street' onchange='setStreet(this);'>"
	+ getListStreet() 
 	+ "</select>"
	+ "</td>"

	+ "<td width='24' valign='bottom' align='left'>"
	+ "<input type='image' src='./images/buttongo.gif' value='Search' width='24' height='17' border='0' alt='GO!' id=image2 name=image2>"
	+ "<img align=bottom border='0' height='2' src='./images/blank.gif' width='20'></td>"

	+ "<td width='20' valign='bottom'>"
	+ "<img align='left' border='0' height='1' src='./images/blank.gif' width='20'>"
	+ "</td>"
	+ "<td width='30' height=24 align='right' valign='top'>"
	+ "<IMG SRC='./flags/" + sCountry + "_flag.gif' height=24 width=48>"
	+ "</td>"
	+ "<td width='20' height=24 align='right' valign='top'>"
	+ "<img border='0' height='24' src='./images/blank.gif' width='20'>"
	+ "</td></tr>"
	+ "</table></form>"
	+ "</td>"
	+ "</tr>";

document.writeln(HTMLStr);

setSelectedItem("country", "frmcountry", sCountry);
setSelectedItem("street", "frmcountry", sStreet);
}

function drawJumpMenu0(iJumpClass)
{
switch (iJumpClass) {
  case 1: drawJumpMenu1('S'); break;
  case 2: drawJumpMenu1('A'); break;
  case 3: drawJumpMenu1('I'); break;
  case 4: drawJumpMenu1('C'); break;
}
}

function getListStreet()
{
var HTMLStr = "<option value='S' selected>&nbsp;Shopping Street"
 + "<option value='I'>&nbsp;Internet Street"
 + "<option value='B'>&nbsp;Business Street"
 + "<option value='A'>&nbsp;Auction Street"
// + "<option value='C'>&nbsp;Classified Street"
// + "<option value='T'>&nbsp;Technology Street"
// + "<option value='K'>&nbsp;College Street"
 + "<option value='J'>&nbsp;Career Street"
// + "<option value='M'>&nbsp;Movie & TV Street"
// + "<option value='V'>&nbsp;Travel Street"
// + "<option value='D'>&nbsp;Download Street"
// + "<option value='L'>&nbsp;LifeStyle Sites"
// + "<option value='H'>&nbsp;Charity Sites"
// + "<option value='O'>&nbsp;Org & Gov Sites"
// + "<option value='P'>&nbsp;Personal Sites"
 + "<option value='@'>&nbsp;My Home"
 + "</select>";

return(HTMLStr);
}

function drawListStreet()
{
var HTMLStr = "<!-- STREET -->"

	+ "<select name='street' id='street'>"
	+ getListStreet()
 	+ "</select>";

document.writeln(HTMLStr);
}

function getListClassified()
{
var HTMLStr =  "<!--Option List-->"
	+ "<option value='SEL'>&nbsp;For Sale"
	+ "<option value='AUT' selected>&nbsp;Automobiles"
	+ "<option value='VHC'>&nbsp;Other Vehical"
	+ "<option value='EST'>&nbsp;Real Estate"
 + "<option value='MER'>&nbsp;Merchandise"
	+ "<option value='VAC'>&nbsp;Vacancies"
	+ "<option value='SER'>&nbsp;Services"
 + "<option value='EDU'>&nbsp;Education"
	+ "<option value='BIZ'>&nbsp;Offices & Biz"
	+ "<option value='WAN'>&nbsp;Wanted"
	+ "<option value='REN'>&nbsp;For Rent"
 + "<option value='HIR'>&nbsp;For Hire";

return(HTMLStr);
}

function getTitleShop(Street, Category)
{
var ShopTitle = Category;

if (Category=="ALL") return("ALL CATEGORIES");

switch (Street) {
case "S":

switch (Category) {
  case "COM": ShopTitle="COMPUTERS"; break;
  case "ELE": ShopTitle="ELECTRONICS"; break;
  case "CAM": ShopTitle="CAMERAS"; break;
  case "MUS": ShopTitle="MUSIC"; break;
  case "BKS": ShopTitle="BOOKS"; break;
  case "GFT": ShopTitle="GIFTS"; break;
  case "FLR": ShopTitle="FLOWERS"; break;
  case "CHC": ShopTitle="CHOCOLATES"; break;
}

break;
case "I":

switch (Category) {
  case "HOS": ShopTitle="DOMAIN HOSTING"; break;
  case "SEL": ShopTitle="DOMAIN RESALE"; break;
  case "AUC": ShopTitle="DOMAIN AUCTION"; break;
  case "REG": ShopTitle="DOMAIN REGISTRATION"; break;
}

break;

}

return(ShopTitle);
}

function getTitleClassified(Category)
{
var ClsfdTitle = Category;

if ((Category=="ALL")||(Category=="AAA")) return("FOR SALE");

switch (Category) {
  case "SEL": ClsfdTitle = "For Sale"; break;
  case "AUT": ClsfdTitle = "Automobiles"; break;
  case "VHC": ClsfdTitle = "Other Vehicals"; break;
  case "EST": ClsfdTitle = "Real Estate"; break;
  case "MER": ClsfdTitle = "Merchandise"; break;
  case "VAC": ClsfdTitle = "Vacancies"; break;
  case "SER": ClsfdTitle = "Services"; break;
  case "EDU": ClsfdTitle = "Education";	break;
  case "BIZ": ClsfdTitle = "Offices & Business"; break;
  case "WAN": ClsfdTitle = "Wanted"; break;
  case "REN": ClsfdTitle = "For Rent"; break;
  case "HIR": ClsfdTitle = "For Hire"; break;
}

return(ClsfdTitle);
}

function drawListClassified()
{
var HTMLStr = "<!-- CLASSIFIEDS -->"

	+ "<select name='category' id='category'>"
	+ getListClassified()
 	+ "</select>";

document.writeln(HTMLStr);
}

function drawJumpShopping()
{
var HTMLStr = "<!-- SHOPPING-STREET -->"

	+ "<input type=hidden name=page value=Shopping>"
	+ "<select name='category' id='category'>"
	+ "<option value='ALL' selected>&nbsp;All Categories"
	+ "<option value='ELE' selected>&nbsp;Electronics"
	+ "<option value='CAM'>&nbsp;Cameras"
 + "<option value='MUS'>&nbsp;Music"
	+ "<option value='BKS'>&nbsp;Books"
	+ "<option value='GFT'>&nbsp;Gifts"
 + "<option value='FLR'>&nbsp;Flowers"
	+ "<option value='CHC'>&nbsp;Chocolates"
 + "</select>"
	+ "&nbsp;"

	+ "<input type='image' src='./images/buttongo.gif' value='Search' width='24' height='17' border='0' alt='GO!' id=image2 name=image2>"

	+ "</td>";

document.writeln(HTMLStr);
}

function drawJumpAuction()
{
var HTMLStr = "<!-- AUCTION-STREET -->"

	+ "<input type=hidden name=page value=Auction>"
	+ "<select name='category' id='category'>"
	+ "<option value='ALL' selected>&nbsp;All Categories"
 	+ "</select>"
	+ "&nbsp;"

	+ "<input type='image' src='./images/buttongo.gif' value='Search' width='24' height='17' border='0' alt='GO!' id=image2 name=image2>"

	+ "</td>";

document.writeln(HTMLStr);
}

function drawJumpClassified()
{
var HTMLStr = "<!-- CLASSIFIEDS -->"

	+ "<input type=hidden name=page value=Classifieds>"
	+ "<select name='category' id='category'>"
	+ getListClassified()
 	+ "</select>"
	+ "&nbsp;"

	+ "<input type='image' src='./images/buttongo.gif' value='Search' width='24' height='17' border='0' alt='GO!' id=image2 name=image2>"

	+ "</td>";

document.writeln(HTMLStr);
}

function drawJumpCity()
{
var HTMLStr = "<!-- CITY -->"

	+ "<form action='./blank.htm' method='get' id='frmcity' name='frmcity'>"
	+ "<input type=hidden name=page value=Classifieds>"
	+ "<select name='city' id='city' onchange='setCity(this);'>"
	+ "<option value='ALL' selected>&nbsp;All City"
	+ "<option value='DEL'>&nbsp;Delhi"
	+ "<option value='BOM'>&nbsp;Mumbai"
	+ "<option value='CCU'>&nbsp;Calcutta"
	+ "<option value='MAS'>&nbsp;Madras"
 	+ "</select>"
	+ "</form>";

document.writeln(HTMLStr);
}

function drawJumpCountry()
{
var HTMLStr = "<!-- SHOPPING-STREET -->"

	+ "<input type=hidden name=page value=Shopping>"
	+ "<select name='category' id='category'>"
	+ "<option value='ALL' selected>&nbsp;All Categories"
	+ "<option value='ELE' selected>&nbsp;Electronics"
	+ "<option value='CAM'>&nbsp;Cameras"
    + "<option value='MUS'>&nbsp;Music"
	+ "<option value='BKS'>&nbsp;Books"
	+ "<option value='GFT'>&nbsp;Gifts"
    + "<option value='FLR'>&nbsp;Flowers"
	+ "<option value='CHC'>&nbsp;Chocolates"
 	+ "</select>"
	+ "&nbsp;"

	+ "<input type='image' src='./images/buttongo.gif' value='Search' width='24' height='17' border='0' alt='GO!'>"

	+ "</td>";

document.writeln(HTMLStr);
}

