// JavaScript Document
var browser = navigator.appName;
var browser_version = navigator.appVersion;
var this_domain = document.domain ;
if (this_domain.indexOf("192.") > -1) this_domain = this_domain + "/dailytrader";
this_domain = "http://"+this_domain;    

var flag = 1;
function selectAll()
{

var mca=document.getElementsByName("mlist[]");

	for (i = 0; i < mca.length; i++)
		mca[i].checked = true ;
}

function clearAll(field)
{
var mca=document.getElementsByName("mlist[]");

	for (i = 0; i < mca.length; i++)
		mca[i].checked = false ;
}

function toggleCategories(){	

	if(document.getElementById('categories').style.display == "block" && flag == 1){
		document.getElementById("hidelink").innerHTML = "<b>HIDE</b>" ;
		document.getElementById("hidelink").className = "hide";
		flag = 0;
	}else if(document.getElementById('categories').style.display == "block" && flag == 0){
		document.getElementById('hidelink').innerHTML = '<b>SHOW</b>';
		document.getElementById('hidelink').className = 'show';
		document.getElementById('categories').style.display = "none";
	}else if(document.getElementById('categories').style.display == "none" && flag == 0){
		document.getElementById("hidelink").innerHTML = "<b>HIDE</b>" ;
		document.getElementById("hidelink").className = "hide";
		document.getElementById('categories').style.display = "block";
	}
	
}

var offsetxpoint = 15 //Customize x offset of tooltip
var offsetypoint = -5 //Customize y offset of tooltip
var ie = document.all
var ns6 = document.getElementById && !document.all
var enabletip=false

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
if (ns6||ie)
{
	thecolor = typeof(thecolor) != 'undefined' ? thecolor : "";
	thewidth = typeof(thewidth) != 'undefined' ? thewidth : "";

	if(thewidth != "") 
		tipobj.style.width = thewidth+"px";
	if(thecolor != "") 
		tipobj.style.backgroundColor = thecolor;

	tipobj.innerHTML=thetext;
	enabletip = true;
	return false;
}
}


function getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null )
	{
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX( oElement )
{
	var iReturnValue = 0;
	while( oElement != null )
	{
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function static_ddrivetip(thetext, thecolor, thewidth, theobject){
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
if (ns6||ie)
{
	var obj = document.getElementById(theobject);
	var obj10 = document.getElementById('image3');

	thecolor = typeof(thecolor) != 'undefined' ? thecolor : "";
	thewidth = typeof(thewidth) != 'undefined' ? thewidth : "";

	if(thewidth != "") 
		tipobj.style.width = thewidth+"px";
	if(thecolor != "") 
		tipobj.style.backgroundColor = thecolor;

	tipobj.innerHTML = thetext;
	enabletip = false;
	_top = getY(obj);
	_left = getX(obj10);
	tipobj.style.top = _top+"px";
	tipobj.style.left = _left+obj.width+20+"px";
	tipobj.style.visibility = "visible";
	return false;
}
}


function positiontip(e)
{
	var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
	if (enabletip)
	{
		var curX = (ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY = (ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var rightedge  = ie&&!window.opera ? ietruebody().clientWidth - event.clientX - offsetxpoint : window.innerWidth - e.clientX - offsetxpoint - 20;
		var bottomedge = ie&&!window.opera ? ietruebody().clientHeight - event.clientY - offsetypoint : window.innerHeight - e.clientY - offsetypoint - 20;
		
		var leftedge = (offsetxpoint<0)? offsetxpoint*(-1) : -1000;
		
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge < tipobj.offsetWidth)
		//move the horizontal position of the menu to the left by it's width
			tipobj.style.left = ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
		else if (curX<leftedge)
			tipobj.style.left = "5px";
		else
		//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left = curX+offsetxpoint+"px";
		
		//same concept with the vertical position
		if (bottomedge < tipobj.offsetHeight)
			tipobj.style.top = ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
		else
			tipobj.style.top = curY+offsetypoint+"px";
		
		tipobj.style.visibility = "visible";
	}
}

function hideddrivetip(){
	var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""	
	if (ns6||ie){
		enabletip=false;
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.backgroundColor='';
		tipobj.style.width='';
	}
}

document.onmousemove = positiontip;


function chkcat()
{
	if( document.getElementById('e_childs').style.visibility == "hidden")
		document.getElementById('e_childs').innerHTML = "";


	if( document.getElementById('e_grandchilds').style.visibility == "hidden")
		document.getElementById('e_grandchilds').innerHTML = "";

}

function show_hide_news(status,news_id)
{
	if(status.id == "hide")
	{
		status.src = "images/1.jpg";
		status.id="show";
		document.getElementById(news_id).style.display="none";
	}
	else 
	{
		status.src = "images/0.jpg";
		status.id="hide";
		document.getElementById(news_id).style.display="";
	}	
}

function setval(a)
{
	var myform = document.getElementById("news");
	document.news.newsdate.value=a;
	document.news.submit();
}

function validate(frm)
{
	if(frm.chk_agreement.checked)	
	{
		return true;
	}
	else
	{
		alert("Please Accept the Terms & Conditions.");
		return false;
	}
}

function getPositionLeft(element)
{
	if (document.all) 
	{
		var leftp = document.getElementById(element).offsetLeft;
	}
	else
	{
		var leftp = document.getElementById(element).offsetLeft;
	}
	return leftp;
}

function getPositionTop(element)
{
	if (document.all) 
	{
		var heightp = document.getElementById(element).offsetHeight-1;
	}
	else
	{
		var heightp = document.getElementById(element).offsetHeight+3;
	}
	return heightp;
}

function showToolTip()
{
	ddrivetip("<ul class=package style=margin-left:15px;line-height:20px;font-size:10px;><li style=list-style-type:none;margin-left:-15px;><b>Basic Supplier</b></li><li style=margin-left:10px;>Manually and thoroughly verified by our staff.</li><li style=margin-left:10px;>Company profile, products and services.</li><li style=margin-left:10px;>Post unlimited number of products and selling leads.</li><li style=margin-left:10px;>Limited exposure and leads as compared to Premium sellers.</li><li style=list-style-type:none;>&nbsp;</li><li style=list-style-type:none;margin-left:-15px;><b>Premium Supplier</b></li><li style=margin-left:10px;>Manually and thoroughly verified by our staff with additional checks.</li><li style=margin-left:10px;>Top ranks and placement providing 20x more leads and higher sales.</li><li style=margin-left:10px;>Premium seller logo endowing better credibility and brand enhancement.</li><li style=margin-left:10px;>Premium sellers get unrestricted access to all sections of Daily Trader.</li><li style=margin-left:10px;>Ultimate trading experience for buyers when dealing with Premium sellers.</li><li style=list-style-type:none;margin-left:-15px;margin-top:5px;>Please click on the link for detailed comparison of both the seller types.</li></ul>", "", 450);			
}

function submitcategory(cat, countryTitle, traderTitle, listings, keyword)
{
	document.location.href = this_domain + "/" + countryTitle + "_" + traderTitle + "_" + listings + "/" + countryTitle + "_" + keyword + "-" + cat + "-1.html";
}

function show_hide_container(container, imgelement)
{
	if(document.getElementById(imgelement) && document.getElementById(imgelement).src == this_domain + '/images/down.gif')
	{
		document.getElementById(container).style.height = 'auto';
		document.getElementById(container).style.overflow = 'auto';
		document.getElementById(imgelement).src = this_domain + '/images/up.gif';
	}
	else if(document.getElementById(imgelement) && document.getElementById(imgelement).src == this_domain + '/images/up.gif')
	{
		document.getElementById(container).style.height = '74px';
		document.getElementById(container).style.overflow = 'hidden';
		document.getElementById(imgelement).src = this_domain + '/images/down.gif';
	}	
}

function addJavascript(jsname,pos) 
{
	var th = document.getElementsByTagName(pos)[0];
	var s = document.createElement('script');
	s.setAttribute('type','text/javascript');
	s.setAttribute('src',jsname);
	th.appendChild(s);
} 

addJavascript(this_domain+'/jscript/advance_search/advance_search.js','head'); 

function check_function()
{
	document.getElementById("hide_option").style.display='block';
	document.getElementById("cat_selector").style.display='block';
	document.getElementById("hide_first").style.display='none';
}
function check_function2()
{
	document.getElementById("cat_selector").style.display='none';
	document.getElementById("hide_option").style.display='none';
	document.getElementById("hide_first").style.display='block';
}
function check_status()
{
	var ch_none = document.getElementById("hide_first").style.display;
	if(ch_none == 'none')
	{
		selectStateAdvance(document.getElementById('wscat').value);
	}
}

function set(frm, country_name){

	var page = "";
	var opt_trader;
	var opt_category;
	var opt_country;
	var search_text = frm.pkey.value;
	
	if(frm.country_option && frm.country_option.value > 0)
	{			
		opt_country = frm.country_option.options[frm.country_option.selectedIndex].text;
		opt_country = opt_country.replace(/ /g, "-");
	}
	else
	{
		opt_country = country_name.replace(/ /g, "-");
	}	
	
	if(frm.category_option && frm.category_option.value > 0)
	{	
		if(frm.cat2_option && frm.cat2_option.value > 0)		
		{
			if(frm.wscat.value > 0 && frm.wscat.value != 2)		
			{
				if(frm.cat3_option && frm.cat3_option.value > 0)		
				{
					opt_category = frm.cat3_option.value; 
				}
				else
				{
					opt_category = frm.cat2_option.value;			
				}				
			}
			else
			{	
				opt_category = frm.cat2_option.value; 			
			}	
		}
		else
		{
			opt_category = frm.category_option.value;
		}	
	}
	else
	{
		opt_category = 0;
	}
	
	if( frm.wscat.value == 2 )
	{ 
		if(frm.supplier_option)	
		{			
			if(frm.supplier_option.value > 0)
			{
				opt_trader = frm.supplier_option.options[frm.supplier_option.selectedIndex].text; 
				opt_trader = opt_trader.replace(/ /g, "_");
			}
			else
				opt_trader = "wholesalers";
		}
		else
		{
			opt_trader = "wholesalers"; 				
		}
	}
	else if( frm.wscat.value == 3 )
	{	
		if(frm.lead_option)
		{	
			if(frm.lead_option.value != 0)
			{
				opt_lead_type = frm.lead_option.options[frm.lead_option.selectedIndex].value; 
				opt_lead_type = opt_lead_type.replace(/ /g, "_");
			}
			else
				opt_lead_type = "trade"; 				
		}
		else
		{
			opt_lead_type = "trade";
		}
	}
	else if( frm.wscat.value == 1 )
	{
		opt_trader = "wholesalers";
	}
	if(search_text.length < 3)
	{
		overlib('<div id=error></div>', STICKY, CLOSECLICK, CAPTION, 'Keyword Length', BGCOLOR, '#535E64', CLOSECOLOR, '#FFFFFF', CAPCOLOR, '#FFFFFF', WIDTH, 355, HEIGHT, 50, CENTERPOPUP);
		getHTML(this_domain+'/show_error.php?errtype=SearchStringLength');
		frm.pkey.value = "";
		frm.pkey.focus();
		return false;
	}
	else if(error_special_char(search_text))
	{
		overlib('<div id=error></div>', STICKY, CLOSECLICK, CAPTION, 'Invalid Keyword Character', BGCOLOR, '#535E64', CLOSECOLOR, '#FFFFFF', CAPCOLOR, '#FFFFFF', WIDTH, 355, HEIGHT, 50, CENTERPOPUP);
		getHTML(this_domain+'/show_error.php?errtype=SpecialCharacter');
		frm.pkey.focus();
		return false;
	}
	else if(frm.wscat.value == "1")
	{
		page = this_domain;
		search_text_url = search_text.split(' ').join('_');
		frm.action = page + "/"+opt_country.toLowerCase()+"_"+opt_trader.toLowerCase()+"_showcase/"+opt_country.toLowerCase()+"_"+search_text_url+"-"+opt_category+"-1.html";			
		return true;
	}
	else if(frm.wscat.value == "2")
	{
		page = this_domain;
		search_text_url = search_text.split(' ').join('_');
		frm.action = page + "/"+opt_country.toLowerCase()+"_"+opt_trader.toLowerCase()+"_list/"+opt_country.toLowerCase()+"_"+search_text_url+"-"+opt_category+"-1.html";			
		return true;
	}
	else if(frm.wscat.value == "3")
	{
		page = this_domain;
		search_text_url = search_text.split(' ').join('_');
		frm.action = page + "/"+opt_country.toLowerCase()+"_"+opt_lead_type.toLowerCase()+"_request/"+opt_country.toLowerCase()+"_"+search_text_url+"-"+opt_category+"-1.html";			
		return true;
	}
	else
	{
		return false;
	}
}

function submitpage(frm, chr)
{
	if(typeof(frm) != 'undefined')
	{
		frm = frm;
	}
	else
	{
	 	frm = document.frmjump;
	}
	
	if(typeof(chr) != 'undefined')
	{
		chr = chr;
	}
	else
	{
	 	chr = '-';
	}	
	
	page_no = frm.txtGo.value;

	if (page_no=="" || page_no==0)
	{
		page_no=1;
	}
	else
	{
		page_no = parseInt(page_no);
	}

	a = location.href;

	url = a.split(chr);

	if(url.length == 3)		// brands url
	{
		url[2] = page_no + ".html";
		a = url[0]+"-"+url[1]+"-"+url[2];
		frm.action = a;
	}
	else if(url.length == 4)
	{
		url[3] = page_no + ".html";
		a = url[0]+"-"+url[1]+"-"+url[2]+"-"+url[3];
		frm.action = a;
	}
	else if(url.length == 5)	
	{
		url[3] = page_no;
		a = url[0]+"-"+url[1]+"-"+url[2]+"-"+url[3]+"-"+url[4];
		frm.action = a;
	}
	else
	{
		url[5] = page_no;
		a = url[0]+"/"+url[1]+"/"+url[2]+"/"+url[3]+"/"+url[4]+"/"+url[5]+".html";
		frm.action = a;
	}	
}

function loc_filter(loc, lead_type)
{
	if(loc.value > 0)
		loc_string = loc.options[loc.selectedIndex].text;
	else
		loc_string = "all";
		
	a = location.href;
	url_arr = a.split("/");
	//******* Setting Page to 1 **************************
	
	pg_element = url_arr[url_arr.length-1];
	pos_pg = pg_element.indexOf('.html');
	pag_arr = pg_element.split("-");
	old_pages = "-"+pag_arr[2]+"-"+pag_arr[3]+"-"+pag_arr[4];
	new_pages = "-"+loc.value+"-1-1.html";
	a = a.replace(old_pages,new_pages);

	//****************************************************
	
	//******* Setting New Contry Title ***********************
	cont_index = url_arr.length-2;
	cont_element = url_arr[cont_index];
	lead_title = "_"+lead_type+"trade_leads";
	cont_pos = cont_element.indexOf(lead_title);
	cont_title = cont_element.substr(0, cont_pos);
	org_value = cont_title+lead_title;
	loc_title = loc_string.replace(/[^a-zA-Z0-9\-]+/g,'-');
	if(loc_title.lastIndexOf('-') == loc_title.length - 1)
	{
		loc_title = loc_title.substring(0, loc_title.length - 1);
	}

	replace_value = loc_title.toLowerCase()+lead_title;
	a = a.replace(org_value,replace_value);

	//********************************************************
	location = a;
}

function checkNumber(val, mx)
{
  var strPass = val.value;

  if (strPass > mx)
  {
	//alert("STOP");
	val.value = "";
	val.focus();
  }
  var strLength = strPass.length;

  var lchar = val.value.charAt((strLength) - 1);
  var cCode = CalcKeyCode(lchar);
  /* Check if the keyed in character is a number
	 do you want alphabetic UPPERCASE only ?
	 or lower case only just check their respective
	 codes and replace the 48 and 57 */

  if (cCode < 48 || cCode > 57 )
  {
	var myNumber = val.value.substring(0, (strLength) - 1);
	val.value = myNumber;
  }
  return false;
}

function CalcKeyCode(aChar) 
{
  var character = aChar.substring(0,1);
  var code = aChar.charCodeAt(0);
  return code;
}

function changecat(catname, mod_rewrite, web_section, country_name, keyword_str1, keyword_str2, country_id)
{
	var mod = mod_rewrite;
	var section = web_section;
	var cat = jsrewrite(catname);
	if(mod == "YES")
	{
		if(section == "wholesaleproducts.php")
		{
			document.forms['formcat'].action = this_domain + "/" + country_name + "_" + keyword_str1 + "/" + cat + "_" + keyword_str2 + "-" + document.forms['formcat'].combocat.value + "-" + country_id + "-" + "1" + "-" + "1" + ".html";
			document.forms['formcat'].submit();
			return true;
		}
		else if(section == "wholesalesuppliers.php")
		{
			document.forms['formcat'].action = this_domain + "/" + country_name + "_" + keyword_str1 + "/" + cat + "_" + keyword_str2 + "-" + document.forms['formcat'].combocat.value + "-" + country_id + "-" + "1" + ".html";
			document.forms['formcat'].submit();
			return true;
		}
		else if(section == "wholesalewanted.php")
		{
			document.forms['formcat'].action = this_domain + "/" + country_name + "_" + keyword_str1 + "trade_leads" + "/" + cat + "_" + keyword_str2 + "-" + document.forms['formcat'].combocat.value + "-" + country_id + "-" + "1" + "-" + "1" + ".html";
			document.forms['formcat'].submit();
			return true;
		}
	}
	else
	{
		document.forms['formcat'].action = this_domain + "/wholesaleproducts.php?cat=" + document.forms['formcat'].combocat.value + "&country="+country_id+"&page=1";
		document.forms['formcat'].submit();
		return true;
	}
}

function jsrewrite(str)
{
	var max_size = 40;
	var t = /[\/\+\&\#\*\,\-\.\?\(\)\:]/g;

	str = str.replace(t, "");
	str = str.substr(0, max_size);
	t = /(\s)/g;
	str = str.replace(t, "_");

	pos = str.lastIndexOf("_");
	if (pos > 30)
	{
		str = str.substr(0, pos);
	}

	return str.toLowerCase(str);
}

function textCounter (field, countfield, maxlimit)
{
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else
		countfield.value = maxlimit - field.value.length;
}

function newWindow(mypage,myname,w,h,features)
{
	if(screen.width)
	{
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
	}
	else
	{
		winl = 0;wint =0;
	}

	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;

	var settings = 'height=' + h + ',';
	settings += 'width=' + w + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	settings += ', scrollbars=yes ';
	window.open(mypage,myname,settings);	
}

function checkemail (emailStr)
{
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null)
	{
		alert("Sorry, email is incorrect");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Sorry, email is incorrect");
			return false;
	   }
	}

	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Sorry, email is incorrect");
			return false;
	   }
	}

	if (user.match(userPat)==null)
	{
		alert("Sorry, email is incorrect");
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Sorry, email is incorrect");
				return false;
			   }
			}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;

	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("Sorry, email is incorrect");
			return false;
		}
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("Sorry, email is incorrect");
		return false;
	}

	if (len<2) {
		alert("Sorry, email is incorrect");
		return false;
	}

	return true;
}

function checkcategories(frm)
{
	if(frm.mcat.value > 0)
	{
		if(frm.ccat)
		{
			if(frm.ccat.value == 0)
			{
				alert('Please Select Last Level Category.');
				return false;
			}
			else
			{
				if(frm.gccat)
				{
					if(frm.gccat.value == 0)
					{
						alert('Please Select Last Level Category.');
						return false;
					}
				}
			}
		}
	}
	else
	{
		alert('Please Select a Category.');
		return false;
	}
	return true;
}

function CheckForm(form)
{
	if(checkcategories(form))
	{
		if(CheckInput(form.price.value, form, "Wholesale Price"))
		{
			if(CheckInput(form.rrp.value, form, "Retail Price"))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}

function CheckInput(str, form, label)
{
	var pattern = /^\d+(\.\d{1,2})?$/;
	if(!str.match(pattern))
	{
		overlib('<div id=error></div>', STICKY, CLOSECLICK, CLOSETEXT, "<span onclick='document.frm2.price.focus();'>Close</span>", CAPTION, label, BGCOLOR, '#535E64', CLOSECOLOR, '#FFFFFF', CAPCOLOR, '#FFFFFF', WIDTH, 395, HEIGHT, 75, CENTERPOPUP);getHTML('show_error.php?errtype=priceformat&pricelabel='+label);
		return false;
	}
	else
	{
		return true;
	}
}

function Widget_Tab(tab_id)
{
	if(tab_id == "widget_sellers_link")
	{
		if(browser_version.indexOf("MSIE 6.0;") > -1)
		{
			document.getElementById("widget_sellers_list").removeAttribute("style");
			document.getElementById("widget_buyers_list").removeAttribute("style");
			document.getElementById("widget_login_list").removeAttribute("style");
			document.getElementById("widget_premium_list").removeAttribute("style");
		}	
		document.getElementById('widget_sellers_list').className = 'widget_current_left_top';
		document.getElementById('widget_sellers_link').className = 'widget_current_left_top';
		document.getElementById('widget_buyers_list').className = 'widget_buyers';
		
		if(browser_version.indexOf("MSIE 6.0;") == -1)
		{	
			document.getElementById('widget_buyers_list').style.marginLeft = '0px';
		}
		
		document.getElementById('widget_buyers_link').className = 'widget_buyers';
		document.getElementById('widget_login_list').className = 'widget_login';
		document.getElementById('widget_login_link').className = 'widget_login';
		document.getElementById('widget_premium_list').className = 'widget_premium';
		
		if(browser_version.indexOf("MSIE 6.0;") == -1)
		{	
			document.getElementById('widget_premium_list').style.marginLeft = '0px';
		}
		
		document.getElementById('widget_premium_link').className = 'widget_premium';
	}
	else if(tab_id == "widget_buyers_link")
	{
		if(browser_version.indexOf("MSIE 6.0;") > -1)
		{
			document.getElementById("widget_sellers_list").removeAttribute("style");
			document.getElementById("widget_buyers_list").removeAttribute("style");
			document.getElementById("widget_login_list").removeAttribute("style");
			document.getElementById("widget_premium_list").removeAttribute("style");
		}
		
		document.getElementById('widget_sellers_list').className = 'widget_sellers';
		document.getElementById('widget_sellers_link').className = 'widget_sellers';
		document.getElementById('widget_buyers_list').className = 'widget_current_right_top';
		document.getElementById('widget_buyers_link').className = 'widget_current_right_top';
		document.getElementById('widget_login_list').className = 'widget_login';
		document.getElementById('widget_login_link').className = 'widget_login';
		document.getElementById('widget_premium_list').className = 'widget_premium';
		
		if(browser_version.indexOf("MSIE 6.0;") == -1)		
		{	
			document.getElementById('widget_premium_list').style.marginLeft = '0px';
		}
		
		document.getElementById('widget_premium_link').className = 'widget_premium';
	}
	else if(tab_id == "widget_login_link")
	{
		if(browser_version.indexOf("MSIE 6.0;") > -1)
		{
			document.getElementById("widget_sellers_list").removeAttribute("style");
			document.getElementById("widget_buyers_list").removeAttribute("style");
			document.getElementById("widget_login_list").removeAttribute("style");
			document.getElementById("widget_premium_list").removeAttribute("style");
		}		
		
		document.getElementById('widget_sellers_list').className = 'widget_sellers';
		document.getElementById('widget_sellers_link').className = 'widget_sellers';
		document.getElementById('widget_buyers_list').className = 'widget_buyers';
		
		if(browser_version.indexOf("MSIE 6.0;") == -1)
		{	
			document.getElementById('widget_buyers_list').style.marginLeft = '2px';
		}
		
		if(browser_version.indexOf("MSIE 6.0;") > -1)
		{
			document.getElementById('widget_sellers_list').style.marginRight = '6px';
		}
		
		document.getElementById('widget_buyers_link').className = 'widget_buyers';
		document.getElementById('widget_login_list').className = 'widget_current_left_bottom';
		document.getElementById('widget_login_link').className = 'widget_current_left_bottom';
		document.getElementById('widget_premium_list').className = 'widget_premium';
		document.getElementById('widget_premium_list').style.marginLeft = '1px';
		document.getElementById('widget_premium_link').className = 'widget_premium';
	}
	else if(tab_id == "widget_premium_link")
	{
		if(browser_version.indexOf("MSIE 6.0;") > -1)
		{
			document.getElementById("widget_sellers_list").removeAttribute("style");
			document.getElementById("widget_buyers_list").removeAttribute("style");
			document.getElementById("widget_login_list").removeAttribute("style");
			document.getElementById("widget_premium_list").removeAttribute("style");
		}		
		
		document.getElementById('widget_sellers_list').className = 'widget_sellers';
		document.getElementById('widget_sellers_link').className = 'widget_sellers';
		document.getElementById('widget_buyers_list').className = 'widget_buyers';
		document.getElementById('widget_buyers_list').style.marginLeft = '2px';
		document.getElementById('widget_buyers_link').className = 'widget_buyers';
		document.getElementById('widget_login_list').className = 'widget_login';
		document.getElementById('widget_login_link').className = 'widget_login';
		document.getElementById('widget_premium_list').className = 'widget_current_right_bottom';
		document.getElementById('widget_premium_link').className = 'widget_current_right_bottom';
	}	
}

function Reset_Focus_login(docElement, eventElement)
{
	eventElement = (typeof eventElement !== 'undefined')? eventElement : "";
	if(document.getElementById("amember_login").value == "Username")
	{	
		docElement.value = "";
	}
	
	if(document.getElementById("amember_pass").value == "")
	{
		Reset_Focus_Password(document.getElementById("amember_pass"));
	}
}

function Reset_Blur_login(docElement, eventElement)
{
	eventElement = (typeof eventElement !== 'undefined')? eventElement : "";
	if(document.getElementById("amember_login").value == "")
	{	
		docElement.value = "Username";
	}
}


function Reset_Focus_Mock_Password(docElement, eventElement)
{
	eventElement = (typeof eventElement !== 'undefined')? eventElement : "";
	
	if(docElement.id == "mock_amember_pass")
	{
		if(document.getElementById("mock_amember_pass").value == "Password")
		{
			docElement.style.display = "none";
			document.getElementById("amember_pass").style.display = "block";
			document.getElementById("amember_pass").focus();
		}	
	}
}

function Reset_Focus_Password(docElement, eventElement)
{
	eventElement = (typeof eventElement !== 'undefined')? eventElement : "";
	
	if(docElement.id == "amember_pass" )
	{
		if(docElement.value == "" && docElement.style.display == "block")
		{	
			docElement.style.display = "none";
			document.getElementById("mock_amember_pass").style.display = "block";
		}	
	}	
}

function Reset_Blur_Password(docElement, eventElement)
{
	eventElement = (typeof eventElement !== 'undefined')? eventElement : "";
	
	if(docElement.id == "amember_pass" )
	{
		if(docElement.value == "" && docElement.style.display == "block")
		{	
			docElement.style.display = "none";
			document.getElementById("mock_amember_pass").style.display = "block";
		}	
	}	
}

function Reset_Focus(docElement, eventElement)
{
	eventElement = (typeof eventElement !== 'undefined')? eventElement : "";

	if(docElement.id == "forgot_login")
	{
		if(document.getElementById("forgot_login").value == "Username")
			docElement.value = "";

		if(document.getElementById("forgot_login").value == "" && eventElement == "onblur")
			docElement.value = "Username";
	}
	else if(docElement.id == "forgot_email")
	{
		if(document.getElementById("forgot_email").value == "Email")
			docElement.value = "";

		if(document.getElementById("forgot_email").value == "" && eventElement == "onblur")
			docElement.value = "Email";		
	}
}

function forgotpasswordurl(url, divcontainer)
{
	if((document.getElementById("forgot_login").value != "" && document.getElementById("forgot_login").value != "Username") || (document.getElementById("forgot_email").value != "" && document.getElementById("forgot_email").value != "Email"))
	{	
		url = url + "?from=widget&login=" + escape(document.getElementById('forgot_login').value) + "&email=" + escape(document.getElementById('forgot_email').value);
		getHTML(url, divcontainer);
		document.getElementById(divcontainer).style.display = "block";
	}
	else
	{
		url = url + "?from=widget&login=&email=";
		getHTML(url, divcontainer);
		document.getElementById(divcontainer).style.display = "block";		
	}
}