//ajax_search_domain.js
function domRegSubmit(frm) {
	var elem = frm.elements['txt_domains[]'];
	var result = false;
	if (elem) {
		if (typeof elem.length != "undefined") {
			for (var i = 0; i < elem.length; i++) {
				if (elem[i].checked) {
					result = true;
					break;
				}
			}
		} else if (typeof elem.checked != "undefined") {
			result = elem.checked;
		}
	}

	if (!result) {
		alert("You must select at least one domain extension.");
	}

	return result;
}

function domRegCheckUncheck(obj) {
	var elem = obj.form.elements['txt_domains[]'];
	if (obj.value == "Check All") {
		var flag = true;
		obj.value = "Uncheck All";
	} else {
		var flag = false;
		obj.value = "Check All";
	}
	if (elem) {
		if (typeof elem.length != "undefined") {
			for (var i = 0; i < elem.length; i++) {
				elem[i].checked = flag;
			}
		} else if (typeof elem.checked != "undefined") {
			elem.checked = flag;
		}
	}
}


//searchpopup.js

function populatePopUp(content, left, top)
{
	var dObj = document.getElementById ? document.getElementById("popupDiv") : document.all.popupDiv;
	dObj.style.left = left;
	dObj.style.top = top;

	var popObj = document.getElementById ? document.getElementById("popContent") : document.all.popContent;
	if (popObj)
	{
		popObj.innerHTML = content;
	}
	else
	{
		var str = "";
		
		str += "<div class=\"bd\" id=\"closeImgDiv\" align=\"right\">";
		str += "<img id=\"closeImg\" src=\""+baseURL+"/images/close.gif\" alt=\"Close\" title=\"Close\" onclick=\"javascript:closePopUp();\" />";
		str += "</div>";
		str += "<div class=\"bd\" id=\"popContent\">";
			str += content;
		str += "</div> <!--[if lte IE 7]><iframe></iframe><![endif]-->";

		dObj.innerHTML = str;
	}
	
	resizePopup();
	
	dObj.style.visibility = "visible";
}

function resizePopup()
{
	var dObj1 = document.getElementById ? document.getElementById("popContent") : document.all.popContent;
	dObj1.style.height = "auto";

	if(getContentHeight() > 500)
	{
		dObj1.style.height = "500px";
	}
}

function closePopUp()
{
	var dObj = document.getElementById ? document.getElementById("popupDiv") : document.all.popupDiv;
	dObj.innerHTML = "";
	dObj.style.visibility = "hidden";
}


function getContentHeight()
{
	var y;
	
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	
	var dObj = document.getElementById ? document.getElementById("popContent") : document.all.popContent;
	
	if (test1 > test2) // all but Explorer Mac
	{
		y = dObj.scrollHeight;
	}
	else // Explorer Mac;
    	 //would also work in Explorer 6 Strict, Mozilla and Safari
	{
		y = dObj.offsetHeight;
	}
	
	return y;
}

//vertical.js

function fadeFieldFocus(objInput) {
	if (!objInput.userTyped) {
		objInput.className =  'fadeOut'; //objInput.className.replace(/(\s)?fadeIn/, '');
		objInput.value = '';
	}
}

function fadeFieldBlur(objInput, text) {
	if (!objInput.userTyped || objInput.value.length == 0) {
		if (objInput.className.indexOf('fadeIn') == -1) {
			objInput.className = 'fadeIn';   //+= ' fadeIn';
		}
		objInput.value = text;
		objInput.userTyped = false;
	}
}

function fadeFieldKeyDown(objInput, e) {
	var key = (window.event) ? (window.event.keyCode) : (e.which);
	objInput.userTyped = true;
	return true;
}

function set_ticker(result){

	document.getElementById('marticker').innerHTML ='';
	document.getElementById('marticker').innerHTML = result;
}

function headerLoginFormSubmit(objForm) {
	var objUserName = objForm.User_ID;
	var objPassword = objForm.passwd;
	var result = true;
	var errorMsg = '';
	if (objUserName && objPassword) {
		fadeFieldFocus(objUserName);
		fadeFieldFocus(objPassword);

		if (objUserName.value.length == 0) {
			errorMsg += '- A valid username is required.\n';
		}

		if (objPassword.value.length == 0) {
			errorMsg += '- A valid password is required.\n';
		}

		if (errorMsg.length > 0) {
			result = false;
			errorMsg = 'Please correct the following error(s):\n' + errorMsg;
			alert(errorMsg);
		}
	}

	return result;
}

// learnmore.js


function displayLearnMore()
{
	var str = "";
	
	str += "<div class=\"select-free\" id=\"learnMoreDiv\">";
	
		str += "<div id=\"closeImgDiv1\" class=\"bd\">";
			str += "<img id=\"closeImg1\" src=\"/images/close.gif\" alt=\"Close\" title=\"Close\" onclick=\"javascript:closeLearnMore();\" />";
		str += "</div>";
		
		str += "<div id=\"learnMoreContent\" class=\"bd\">";
			
			str += "<table id=\"learnMoreHeader\">";
				str += "<tr><td style=\"height:30px; border:1px solid gray; font-size: 14px;\">";
					str += "<span style=\"margin-left:10px\">Learn About Weblo</span>";
				str += "</td></tr>";
			str += "</table>";
			
			str += "<table id=\"outerTable\" style=\"margin:0px; padding:0px; border-collapse:collapse; border-spacing:0px\">";
			str += "<tr>";
				str += "<td style=\"padding:0px; vertical-align:top;width:300px\">";
					str += "<table style=\"margin:0px; padding:0px; border-collapse:collapse; border-spacing:0px\">";
					str += "<tr>";
						str += "<td class=\"learnMenu\" id=\"m1\"><span class=\"learnMenuItem\" onmouseover=\"javascript:learnMenuOver(this);\" onmouseout=\"javascript:learnMenuOut(this);\" onclick=\"javascript:gotoMenu('m1');\">What is Weblo?</span></td>";
					str += "<tr>";
					str += "<tr>";
						str += "<td class=\"learnMenu\" id=\"m2\"><span class=\"learnMenuItem\" onmouseover=\"javascript:learnMenuOver(this);\" onmouseout=\"javascript:learnMenuOut(this);\" onclick=\"javascript:gotoMenu('m2');\">Getting Started</span></td>";
					str += "<tr>";
					str += "<tr>";
						str += "<td class=\"learnMenu\" id=\"m3\"><span class=\"learnMenuItem\" onmouseover=\"javascript:learnMenuOver(this);\" onmouseout=\"javascript:learnMenuOut(this);\" onclick=\"javascript:gotoMenu('m3');\">Making Money at Weblo</span></td>";
					str += "<tr>";
					str += "<tr>";
						str += "<td class=\"learnMenu\" id=\"m4\"><span class=\"learnMenuItem\" onmouseover=\"javascript:learnMenuOver(this);\" onmouseout=\"javascript:learnMenuOut(this);\" onclick=\"javascript:gotoMenu('m4');\">Building Your Virtual Empire! - It's Easy!</span></td>";
					str += "<tr>";
					str += "<tr>";
						str += "<td class=\"learnMenu\" id=\"m5\"><span class=\"learnMenuItem\" onmouseover=\"javascript:learnMenuOver(this);\" onmouseout=\"javascript:learnMenuOut(this);\" onclick=\"javascript:gotoMenu('m5');\">The World is Yours - Join Now!</span></td>";
					str += "<tr>";
					str += "<tr>";
						str += "<td id=\"dummyTD\"></td>";
					str += "<tr>";
					str += "</table>";
					
					
				str += "</td>";
				
				str += "<td style=\"vertical-align:top; border-right:1px solid gray; border-bottom:1px solid gray;\">";
					str += "<div id=\"learnTextDiv\"></div>";
				str += "</td>";
			str += "</tr>";
			str += "</table>";
			
		str += "</div><!--[if lte IE 7]><iframe></iframe><![endif]-->";
	
	str += "</div>";
	
	document.write(str);
	
	var dObj = document.getElementById ? document.getElementById("m1") : document.all.m1;
	dObj.style.borderRight = "1px solid white";
	dObj.style.backgroundColor = "white";
	
	populate_m1();
}


function closeLearnMore()
{
	var dObj = document.getElementById ? document.getElementById("learnMoreDiv") : document.all.learnMoreDiv;
	dObj.style.visibility = "hidden";
	dObj.style.display = "none";
}

function openLearnMore()
{
	var dObj = document.getElementById ? document.getElementById("learnMoreDiv") : document.all.learnMoreDiv;
	dObj.style.visibility = "visible";
	dObj.style.display = "block";
}

function learnMenuOver(mObj)
{
	mObj.style.color = "orange";
}

function learnMenuOut(mObj)
{
	mObj.style.color = "#018BC6";
}

function gotoMenu(m)
{
	var obj = null;
	
	for(var i = 0; i < 5; i++)
	{
		obj = document.getElementById ? document.getElementById("m" + (i + 1)) : eval("document.all.m" + (i + 1));
		obj.style.borderRight = "1px solid gray";
		obj.style.backgroundColor = "rgb(238,238,238)";
	}

	var dObj = document.getElementById ? document.getElementById(m) : eval("document.all." + m);
	dObj.style.borderRight = "white";
	dObj.style.backgroundColor = "white";

	eval("populate_" + m + "()");
}

function populate_m1()

{
	var str = "";
	
	str += "<span class=\"mTitle\">What is Weblo?</span><br /><br />";
	
	str += "Weblo is a virtual replica of the real world where you can own anything - from your hometown, to your favorite sports stadium, to New York City!<br /><br />";
	
	str += "This is the only site where virtual duplicates of real world cities, states, properties, domains and celebrities can be yours!";

	str += getNextFooter("m2");
	
	var obj = document.getElementById ? document.getElementById("learnTextDiv") : document.all.learnTextDiv;
	obj.innerHTML = str;
}

function populate_m2()
{
	var str = "";
	
	str += "<span class=\"mTitle\">Getting Started</span><br /><br />";
	
	str += "Joining Weblo is fast and easy!<br /><br />";
	
	str += "A basic membership is FREE and you get a free celebrity fan site.<br /><br />";
	
	str += "You have 5 choices: Basic (free), Bronze, Silver, Gold and VIP.<br /><br />";
	
	str += "The 4 remaining membership options are bronze, silver, gold and VIP. These memberships range in price from $45-$269US annually and come with free celebrity fan sites and many other benefits including discounts for purchasing cities, properties and Internet domains.";

	str += getNextFooter("m3");
	
	var obj = document.getElementById ? document.getElementById("learnTextDiv") : document.all.learnTextDiv;
	obj.innerHTML = str;
}

function populate_m3()
{
	var str = "";
	
	str += "<span class=\"mTitle\">Making Money at Weblo</span><br /><br />";
	
	str += "As a basic (free) member at Weblo you get a free celebrity fan site and you get paid for the popularity of your fan site.  Weblo puts advertisements on your fan site and you earn money every time someone clicks on those ads.<br /><br />";
	
	str += "As a city or state owner you earn money from all transactions in your territory.  This means every time someone buys a property or clicks an advertisement in your territory you get paid.<br /><br />";
	
	str += "Cities and states grow in value as more people join Weblo and many cities have already re-sold for huge profits.  There is only one Tokyo at Weblo and that's why its sale price keeps going up!<br /><br />";
	
	str += "Weblo properties and domains earn money from advertisements. Properties and domains go up in value and can be re-sold for profit just like in the real world.<br /><br />";
	
	str += "To learn more please visit our <a class=\"learnMoreA1\" style=\"font-size: 12px;color: #018bc6;\" href=\"" + baseURL + "/main/index.php?Action=Main.MoneyMaking\" target=\"_blank\">Make Money on Weblo</a> section.";

	str += getNextFooter("m4");
	
	var obj = document.getElementById ? document.getElementById("learnTextDiv") : document.all.learnTextDiv;
	obj.innerHTML = str;
}

function populate_m4()
{
	var str = "";
	
	str += "<span class=\"mTitle\">Building your virtual empire! - It's Easy!</span><br /><br />";
	
	str += "Weblo provides a  very simple template for building websites to show off your Weblo Assets.  It helps you upload pictures, videos, blogs, forums, polls and news to your websites.<br /><br />";
	
	str += "It's so easy that within minutes your website is ready for the world to see. Start making money now!";

	str += getNextFooter("m5");
	
	var obj = document.getElementById ? document.getElementById("learnTextDiv") : document.all.learnTextDiv;
	obj.innerHTML = str;
}

function populate_m5()
{
	var str = "";
	
	str += "<span class=\"mTitle\">The World is Yours - Join Now!</span><br /><br />";
	
	str += "Imagine telling your friends you are the Mayor of New York, London or Tokyo - Our Weblo Members are doing that right now!<br /><br />";
	
	str += "Just like in the real world, commanding an empire leads to power, prestige and wealth.<br /><br />";
	
	str += "Your first step is joining.  It's free, fast and easy!<br /><br />";
	
	str += "<span style=\"font-weight:bold\">CLICK OUR BIG JOIN NOW BUTTON!</span><br /><br /><br />";
	
	str += "<a class=\"learnMoreA1\" href=\"" + baseURL + "/signup/\"><div id=\"joinBDiv\"><div style=\"margin-top:6px\">Join Now!</div></div></a>";


	var obj = document.getElementById ? document.getElementById("learnTextDiv") : document.all.learnTextDiv;
	obj.innerHTML = str;
}

function getNextFooter(m)
{
	var str = "";
	
	str += "<br /><br /><a class=\"learnMoreA1\" style=\"font-size: 12px;color: #018bc6;\" href=\"" + baseURL + "/signup/\">Join Now</a> | <span id=\"footerSpan\" onmouseover=\"javascript:learnMenuOver(this);\" onmouseout=\"javascript:learnMenuOut(this);\" onclick=\"javascript:gotoMenu('" + m + "');\">Next &raquo;</span>";
	
	return str;
}

//buysell.js

function showhideprice(id)
{	
	if (document.f.resale.checked)
	{			
		document.getElementById(id).style.visibility = visible;
	}
	else
	{
		document.getElementById(id).style.visibility = hidden;
	}
}
	
function showhide(status,id)
{
	document.getElementById(id).style.visibility = status;	
}

function hideshow(val,id)
{
	if (val)
	{			
		showhide("visible",id);
	}
	else
	{
		showhide("hidden",id);
	}		
}
	
function CheckForm()
{
	
if(!validateStandard(document.getElementById('f'), 'errorDiv')){
	return;	
}
sendToConfirm();		
}
	
function sendToConfirm()
{
		url = baseURL+'/buysell/index.php?';
		var params = 'Action=buysell.prop_purchase_confirm_ajax';
		params += '&Asset_Type=' + chkExists('Asset_Type');
		params += '&assetID=' + chkExists('assetID');
		params += '&assetType=' + chkExists('assetType');
		params += '&assetPrice=' + chkExists('assetPrice');
		params += '&assetOwner=' + chkExists('assetOwner');
		params += '&assetDescription=' + chkExists('assetDescription');
		params += '&assetBuyingReason=' + chkExists('assetBuyingReason');
		params += '&CountryCode=' + chkExists('CountryCode');
		params += '&assetName=' + chkExists('assetName');
		params += '&pdesc=' + chkExists('pdesc');
		params += '&reason=' + chkExists('reason');
		params += '&immigrant=' + chkExists('immigrant');
		if(document.f.immi)
			immi = getSelectedValue(document.f.immi);
		else
			immi = '';

		params +=  '&immi=' + immi;

		if(immi=='No'){			
			urg_reg = '';
			resale = '';
			sell_price = '0';
		}
		else{
			
			if(document.f.urg_reg)
				urg_reg = getSelectedValue(document.f.urg_reg);
			else
				urg_reg = '';
			
				
			if(document.getElementById('resale'))
			{				
				if(document.getElementById('resale').checked==true)
				{
					resale=chkExists('resale');
					sell_price = chkExists('sell_price');
				}
				else{
					resale=0;
					sell_price = '0';
				}
			}	
		}
		
		if(immi=='Yes'){
			immi = '1';
		}else if(immi=='No'){
			immi = '0';	
		}
		
		if(!document.f.immi)
		{
			if(document.getElementById('resale'))
			{				
				if(document.getElementById('resale').checked==true)
				{
					resale=chkExists('resale');
					sell_price = chkExists('sell_price');
				}
				else{
					resale='0';
					sell_price = '0';
				}
			}	
		}
		
		
		if(isNaN(sell_price))
			sell_price = '0';
		sell_price = (sell_price=='')?'0':sell_price;		
		params += '&resale=' + resale;
		params += '&sell_price=' + sell_price;
		
		params +=  '&urg_reg=' + urg_reg;
		if(document.getElementById('signInConfirm').value=='true')
			params += '&signInConfirm=true';
		else
			params += '&signInConfirm=false';
		
		if(document.getElementById('DeedReqd'))
		{
			DeedReqd = getSelectedValue(document.getElementById('DeedReqd'));
			DeedReqd = (DeedReqd=='')?'0':DeedReqd;
		}
		else
			DeedReqd = '0';
		
		params += '&DeedReqd=' + DeedReqd;
		document.getElementById('buyDiv').innerHTML = waitDiv();		
		ajax_do_call(url,'',params,setDivContent);		
		
}
	
	
function generateReceipt(){
		if(!validateStandard(document.getElementById('f'), 'errorDiv')){
			return;	
		}
		
		if(document.getElementById('txtPassword').value==''){
			document.getElementById('pwdMsg').innerHTML = 'Password Required.';
		}		
		url = baseURL+'/buysell/index.php';
		var params = 'Action=buysell.prop_purchase_receipt_ajax';
		params += '&assetID=' + chkExists('assetID');
		params += '&assetType=' + chkExists('assetType');
		params += '&assetPrice=' + chkExists('assetPrice');
		params += '&assetOwner=' + chkExists('assetOwner');
		params += '&assetDescription=' + chkExists('assetDescription');
		params += '&assetBuyingReason=' + chkExists('assetBuyingReason');
		params += '&CountryCode=' + chkExists('CountryCode');
		params += '&assetName=' + chkExists('assetName');
		params += '&pdesc=' + chkExists('pdesc');
		params += '&reason=' + chkExists('reason');
		params += '&image=' + chkExists('image');			
		params += '&immigrant=' + chkExists('immigrant');
		params +=  '&immi=' + chkExists('immi');
		params +=  '&urg_reg=' + chkExists('urg_reg');
		params += '&resale=' + chkExists('resale');		
		params += '&sell_price=' + chkExists('sell_price');
		params += '&DeedReqd=' + chkExists('DeedReqd');
		params += '&paymentmode=' + chkExists('paymentmode');
		params += '&totalTax=' + chkExists('totalTax');
		params += '&tax=' + chkExists('tax');
		params += '&total=' + chkExists('total');		
		if(document.f.paymentype)
			paymentype = getSelectedValue(document.f.paymentype);
		else
			paymentype = '';
		params += '&paymentype=' + paymentype;
		params += '&txtWebloAccount=' + chkExists('txtWebloAccount');
		params += '&txtTotalAmount=' + chkExists('txtTotalAmount');
		params += '&txtPassword=' + chkExists('txtPassword');
		if(document.getElementById('signInConfirm').value=='true')
			params += '&signInConfirm=true';
		else
			params += '&signInConfirm=false';

		document.getElementById('buyDiv').innerHTML = waitDiv();
		ajax_do_call(url,'',params,setDivContent);
}
	
	
	
function getSelectedValue(radioObj){
	
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
	/*for(cnt=0;cnt<objField.length;cnt++)
	{
			if(objField[cnt].checked==true)
			{
				fieldValue = objField[cnt].value;
				break;
			}
	}
	return fieldValue;*/
}
	
/* START: Buy Asset Methods */
function buyAsset(url,event){	
	clearDivHeading();
	screenWidth1 	= screenWidth();
	screenHeight1 	= screenHeight();
	scrollWidth1 	= scrollWidth();
	scrollHeight1 	= scrollHeight();
	popupWidth		= 540;
	popupHeight		= 200; //BuyIt Form display
	scrollHeight1 += screenHeight1/2 - popupHeight;
	x = (screenWidth1-popupWidth)/2;
	y = (scrollHeight1);
	popUp = document.getElementById('buyItDiv');
	popUp.style.width=popupWidth+'px';
	popUp.style.left=x+'px';
	popUp.style.top=y+'px';
	popUp.style.display='';
	document.getElementById('buyDiv').style.width=popupWidth+'px';
	document.getElementById('buyDiv').innerHTML = waitDiv();
	ajax_do_call(url,'','',setDivContent);
}

function isValidAmmount(ammount){
	if(ammount<=0 || isNaN(ammount)){
		document.getElementById('chkCashFromMe').innerHTML='Invalid amount';
		return false;
	}else{
		return true;
	}
}

function roundNumber(rnum) {
	var rlength = 2; // The number of decimal places to round to
	if (rnum > 8191 && rnum < 10485) {
	rnum = rnum-5000;
	var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	newnumber = newnumber+5000;
	} else {
	var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	}
	return newnumber;
}
/* END: Buy Asset Methods */

/* START: Place Bid Methods */
function placeBid(url,event){
	//buyAsset(url,event);
	clearDivHeading();
	screenWidth1 	= screenWidth();
	screenHeight1 	= screenHeight();
	scrollWidth1 	= scrollWidth();
	scrollHeight1 	= scrollHeight();
	popupWidth		= 540;
	
	if(document.getElementById('signInConfirm')==null)
		popupHeight		= 100; //Sign In From display	
	else
		popupHeight		= 200; //BuyIt Form display
	
	scrollHeight1 += screenHeight1/2 - popupHeight;
	x = (screenWidth1-popupWidth)/2;
	y = (scrollHeight1);
	
	popUp = document.getElementById('buyItDiv');
	popUp.style.width=popupWidth+'px';
	popUp.style.left=x+'px';
	popUp.style.top=y+'px';
	popUp.style.display='';
	document.getElementById('buyDiv').style.width=popupWidth+'px';
	document.getElementById('buyDiv').innerHTML = waitDiv();
	ajax_do_call(url,'','',setDivContent);
}

function placeBidSubmit(max_bid_amount){
	if(!validateStandard(document.getElementById('PlaceAuctionBidForm'), 'errorDiv')){
		return;	
	}
	
	if(check_bid_amount(max_bid_amount)){
	url = baseURL+'/auction/index.php?Action=auction.bid_on_auction_submit_ajax';
	url += '&bid_amount=' + chkExists('bid_amount');
	
	if(document.getElementById('is_anonymous'))
	{
		if(document.getElementById('is_anonymous').checked==true)
			is_anonymous = chkExists('is_anonymous');
		else
			is_anonymous = 0;
	}
	url += '&is_anonymous=' + is_anonymous;
	
	url += '&asset_id=' + chkExists('asset_id');
	url += '&bid_link_text=' + chkExists('bid_link_text');
	url += '&bid_link=' + chkExists('bid_link');
	url += '&auction_id=' + chkExists('auction_id');
	url += '&asset_price=' + chkExists('asset_price');
	url += '&asset_status=' + chkExists('asset_status');
	if(document.getElementById('chksubscribed'))
	{
		if(document.getElementById('chksubscribed').checked==true)
			chksubscribed = chkExists('chksubscribed');
		else
			chksubscribed = '';
	}
	url += '&chksubscribed=' + chksubscribed;
	if(document.getElementById('signInConfirm').value=='true')
			url += '&signInConfirm=true';
		else
			url += '&signInConfirm=false';

	document.getElementById('buyDiv').innerHTML = waitDiv();
	ajax_do_call(url,'','',setDivContent);
	}
	else	
		return;
}
/* END: Place Bid Methods */


/* START: Place Offer Methods */
function placeOffer(url,event){
	clearDivHeading();
	screenWidth1 	= screenWidth();
	screenHeight1 	= screenHeight();
	scrollWidth1 	= scrollWidth();
	scrollHeight1 	= scrollHeight();
	popupWidth		= 540;
	popupHeight		= 100;
	
	scrollHeight1 += screenHeight1/2 - popupHeight;

	x = (screenWidth1-popupWidth)/2;
	y = (scrollHeight1);	
	
	var buyItDiv = document.getElementById('buyItDiv');
	if (!buyItDiv) {
		buyItDiv = createBuySellDiv();
	}
	var buyDiv = document.getElementById('buyDiv');
	buyItDiv.style.width=popupWidth+'px';
	buyItDiv.style.left=x+'px';
	buyItDiv.style.top=y+'px';
	buyItDiv.style.display='';
	buyDiv.style.width=popupWidth+'px';
	buyDiv.innerHTML = waitDiv();
	ajax_do_call(url,'','',setDivContent);	
}

			
function waitDiv(){
	strWaitDiv = 
	'<div id="WaitDiv" style="text-align: center; width: 350px; height: auto; background-color: #F2F2F2; padding: 8px; margin-left: auto; margin-right: auto">' +
	'<img src="' + baseURL + '/images/loading.gif" alt="Loading" />' + 
	'<br />Please wait...<br /><br />' + 
	'</div>';
return strWaitDiv;
}

function createBuySellDiv() {
	var buyItDiv = document.createElement('div');
	buyItDiv.setAttribute('id', 'buyItDiv');
	buyItDiv.style.position = 'absolute';
	buyItDiv.style.width = '400px';
	buyItDiv.style.height = 'auto';
	buyItDiv.style.zIndex = '99';
	buyItDiv.style.display = 'none';
	buyItDiv.style.padding = '8px';
	buyItDiv.style.border = '1px solid #999999';
	buyItDiv.style.backgroundColor = '#F2F2F2';

	var buyItTable = document.createElement('table');
	buyItTable.cellSpacing = 0;
	buyItTable.style.marginLeft = 'auto';
	buyItTable.style.marginRight = 'auto';
	var buyItTableBody = document.createElement('tbody');

	var tr1 = document.createElement('tr');
	var td1_1 = document.createElement('td');
	td1_1.style.textAlign = 'left';
	var buysellHeadingDiv = document.createElement('div');
	buysellHeadingDiv.setAttribute('id', 'buysellHeading');
	buysellHeadingDiv.className = 'divHeading';
	td1_1.appendChild(buysellHeadingDiv);
	tr1.appendChild(td1_1);

	var td1_2 = document.createElement('td');
	td1_2.style.textAlign = 'right';
	var closeAnchor = document.createElement('a');
	closeAnchor.href = '#';
	closeAnchor.onclick = new Function('closeBuySellDiv(); return false;');
	var closeImg = document.createElement('img');
	closeImg.src = baseURL + '/images/asset_pages/close_icon.gif';
	closeImg.alt = 'Close';
	closeImg.style.width = '15px';
	closeImg.style.height = '13px';
	closeAnchor.appendChild(closeImg);
	td1_2.appendChild(closeAnchor);
	tr1.appendChild(td1_2);

	var tr2 = document.createElement('tr');
	var td2_1 = document.createElement('td');
	td2_1.colSpan = 2;
	td2_1.textAlign = 'center';
	var buyDiv = document.createElement('div');
	buyDiv.setAttribute('id', 'buyDiv');
	buyDiv.style.position = 'relative';
	buyDiv.style.height = 'auto';
	buyDiv.style.marginLeft = 'auto';
	buyDiv.style.marginRight = 'auto';
	td2_1.appendChild(buyDiv);
	tr2.appendChild(td2_1);

	buyItTableBody.appendChild(tr1);
	buyItTableBody.appendChild(tr2);
	buyItTable.appendChild(buyItTableBody);
	buyItDiv.appendChild(buyItTable);

	document.body.appendChild(buyItDiv);

	return buyItDiv;
}			

/* START: Sign In Methods */
function signInProcess(){
	if(!validateStandard(document.getElementById('frmLogAjax'), 'errorDiv')){
		return;	
	}
	
	url = baseURL+'/signin/index.php?Action=SignIn.SignInProcessAjax';
	url += '&User_ID=' + chkExists('UID');
	url += '&passwd=' + document.frmLogAjax.passwd.value;
	
	if(document.getElementById('remember'))
	{
		if(document.getElementById('remember').checked==true)
			remember = chkExists('remember');
		else
			remember = 0;
	}
	url += '&remember=' + remember;
	
	url += '&url2go=' + chkExists('url2go');
	url += '&parent_url=' + chkExists('parent_url');
	url += '&assetID=' + chkExists('assetID');
	url += '&singInConfirm=true';
	
	document.getElementById('buyDiv').innerHTML = waitDiv();								
	ajax_do_call(url,'','',setDivContent);
	return false;
}
/* END: Sign In Methods */


function AddNewOffer(){		
	if(validateStandard(document.getElementById('form1'), 'errorDiv'))
	{
		signInConfirm = chkExists('signInConfirm');
		AssetID = chkExists('AssetID');
		Amount = chkExists('CashFromMe');
		Description = chkExists('OfferDetails');	
		
		if(isValidAmmount(Amount)==false){
			return false;
		}
		Amount=roundNumber(Amount);
		document.getElementById('buyDiv').innerHTML = '';	
		document.getElementById('buyDiv').innerHTML = waitDivOffer();	
		
		url = baseURL+'/buysell/index.php?Action=buysell.NewOfferDivSave&AssetID='+AssetID+'&description='+Description+'&amount='+Amount;
		
		if(signInConfirm)
				url += '&signInConfirm=true';
			else
				url += '&signInConfirm=false';	
				
		ajax_do_call(url,'','',setDivContent);		
	}
	else
	{
		return;
	}
}

function isValidAmmount(ammount){
	if(ammount<=0 || isNaN(ammount)){
		if(document.getElementById('chkCashFromMe'))
			document.getElementById('chkCashFromMe').innerHTML='Invalid amount';
		return false;
	}else{
		return true;
	}
}

function roundNumber(rnum) {
	var rlength = 2; // The number of decimal places to round to
	if (rnum > 8191 && rnum < 10485) {
	rnum = rnum-5000;
	var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	newnumber = newnumber+5000;
	} else {
	var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
	}
	return newnumber;
}

function CountAndTrimText(object){			
	currentChar=object.value.length;
	if(currentChar>=100){
		object.value=object.value.substring(0,100);
	}
	
	leftChar=100-currentChar;
	if(leftChar<=0){
		leftChar=0;
	}	
	if(currentChar<=0){
		leftChar = 100;	
	}
	document.getElementById('LeftChar').innerHTML=leftChar+' characters left';
}

function setDivContent(output){
	document.getElementById('buyDiv').innerHTML = output;
	if(document.getElementById('bsHeading')){
		document.getElementById('buysellHeading').innerHTML = document.getElementById('bsHeading').value;
	}
}

function closeBuySellDiv(){		
	if(document.getElementById('signInConfirm')!=null && document.getElementById('signInConfirm').value=='true')
	{
		window.location.reload();
	}	
	document.getElementById('buyItDiv').style.display='none';
}

function clearDivHeading(){	
	if(document.getElementById('buysellHeading'))
		document.getElementById('buysellHeading').innerHTML='';
}


/* Screen Width/Height Scroll Width/Height */
function screenWidth(){
	var x;
	if (self.innerWidth) // all except Explorer
	{
		x = self.innerWidth;	
	}
	else if (document.documentElement && document.documentElement.clientWidth)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
	}
	
	return x;
}

function screenHeight(){
	var y;
	if (self.innerHeight) // all except Explorer
	{
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		y = document.body.clientHeight;
	}
	return y;
}


function scrollWidth(){
	var x;
	if (self.pageXOffset) // all except Explorer
	{
		x = self.pageXOffset;
	}
	else if (document.documentElement && document.documentElement.scrollLeft)
		// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;		
	}
	return x;
}

function scrollHeight(){
	var y;
	if (self.pageYOffset) // all except Explorer
	{
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		y = document.body.scrollTop;
	}
	
	return y;
}

function waitDivOffer(){
	strWaitDiv =
	'<div id="WaitDiv" style="text-align: center; margin-left: auto; margin-right: auto">' +
	'<img src="' + baseURL + '/images/loading.gif" alt="Loading" />' + 
	'<br />Your offer is being processed. Please be patient.<br /><br />' + 
	'</div>';
	return strWaitDiv;
}

/* This function is used to check element exist or not */
function chkExists(elementName){
	obj = document.getElementById(elementName);
	if (obj) {
		return obj.value;
	} 
	else {
		return "";
	}
}


function hideShowLayer(elementName,status){
	document.getElementById(elementName).style.display=status;
}

function showHideBidHistory(elementName){
	objField = document.getElementById(elementName);
	if(objField.style.display==''){
		objField.style.display='none';
		document.getElementById('hideShowText').innerHTML = 'Show';
	}
	else{
		objField.style.display='';
		document.getElementById('hideShowText').innerHTML = 'Hide';
	}
}

function check_bid_amount(max_bid_amount) {
	var result = true;
	if (max_bid_amount!='' || max_bid_amount!=0) {
			var bid = parseFloat(document.forms['PlaceAuctionBidForm'].bid_amount.value);
			if (!isNaN(bid)) {
				if (bid < max_bid_amount) {
					result = confirm('Are you sure you want to place a bid smaller than the maximum bid of '+max_bid_amount);
				} else if (bid == max_bid_amount) {
					result = false;
					alert('You cannot place a bid equal to the highest bid.');
				}
		}
		return result;
	}
}


// jsval.js



function validateCompleteForm(objForm,strErrorClass){
return _validateInternal(objForm,strErrorClass,0);
};
function validateStandard(objForm,strErrorClass){		
return _validateInternal(objForm,strErrorClass,1);
};
function _validateInternal(form,strErrorClass,nErrorThrowType){
var strErrorMessage="";var objFirstError=null;
if(nErrorThrowType==0){
strErrorMessage=(form.err)?form.err:_getLanguageText("err_form");
};
var fields=_GenerateFormFields(form);
for(var i=0;i<fields.length;++i){
var field=fields[i];
if(!field.IsValid(fields)){
field.SetClass(strErrorClass);
if(nErrorThrowType==1){
_throwError(field);
return false;
}else{
if(objFirstError==null){
objFirstError=field;
}
strErrorMessage=_handleError(field,strErrorMessage);
bError=true;
}
}else{
field.ResetClass();
}
};
if(objFirstError!=null){
//alert(strErrorMessage);
document.getElementById("ErrorMessage").innnerHTML =
objFirstError.element.focus();
return false;
};
return true;
};
function _getLanguageText(id){
objTextsInternal=new _jsVal_Language();
objTexts=null;
try{
objTexts=new jsVal_Language();
}catch(ignored){};
switch(id){
case "err_form":strResult=(!objTexts||!objTexts.err_form)?objTextsInternal.err_form:objTexts.err_form;break;
case "err_enter":strResult=(!objTexts||!objTexts.err_enter)?objTextsInternal.err_enter:objTexts.err_enter;break;
case "err_select":strResult=(!objTexts||!objTexts.err_select)?objTextsInternal.err_select:objTexts.err_select;break;
};
return strResult;
};
function _GenerateFormFields(form){
var arr=new Array();
for(var i=0;i<form.length;++i){
var element=form.elements[i];
var index=_getElementIndex(arr,element);
if(index==-1){
arr[arr.length]=new Field1(element,form);
}else{
arr[index].Merge(element)
};
};
return arr;
};
function _getElementIndex(arr,element){
if(element.name){
var elementName=element.name.toLowerCase();
for(var i=0;i<arr.length;++i){
if(arr[i].element.name){
if(arr[i].element.name.toLowerCase()==elementName){
return i;
}
};
};
}
return -1;
};
function _jsVal_Language(){
this.err_form="Please enter/select values for the following fields:\n\n";
this.err_select="Please select a valid \"%FIELDNAME%\"";
this.err_enter="Please enter a valid \"%FIELDNAME%\"";
};
function Field1(element,form){
this.type=element.type;
this.element=element;
this.exclude=element.exclude||element.getAttribute('exclude');
this.err=element.err||element.getAttribute('err');
this.required=_parseBoolean(element.required||element.getAttribute('required'));
this.realname=element.realname||element.getAttribute('realname');
this.elements=new Array();
switch(this.type){
case "textarea":
case "password":
case "text":
case "file":
this.value=element.value;
this.minLength=element.minlength||element.getAttribute('minlength');
this.maxLength=element.maxlength||element.getAttribute('maxlength');
this.regexp=this._getRegEx(element);
this.minValue=element.minvalue||element.getAttribute('minvalue');
this.maxValue=element.maxvalue||element.getAttribute('maxvalue');
this.equals=element.equals||element.getAttribute('equals');
this.callback=element.callback||element.getAttribute('callback');
break;
case "select-one":
case "select-multiple":
this.values=new Array();
for(var i=0;i<element.options.length;++i){
if(element.options[i].selected&&(!this.exclude||element.options[i].value!=this.exclude)){
this.values[this.values.length]=element.options[i].value;
}
}
this.min=element.min||element.getAttribute('min');
this.max=element.max||element.getAttribute('max');
this.equals=element.equals||element.getAttribute('equals');
break;
case "checkbox":
this.min=element.min||element.getAttribute('min');
this.max=element.max||element.getAttribute('max');
case "radio":
this.required=_parseBoolean(this.required||element.getAttribute('required'));
this.values=new Array();
if(element.checked){
this.values[0]=element.value;
}
this.elements[0]=element;
break;
};
};
Field1.prototype.Merge=function(element){
var required=_parseBoolean(element.getAttribute('required'));
if(required){
this.required=true;
};
if(!this.err){
this.err=element.getAttribute('err');
};
if(!this.equals){
this.equals=element.getAttribute('equals');
};
if(!this.callback){
this.callback=element.getAttribute('callback');
};
if(!this.realname){
this.realname=element.getAttribute('realname');
};
if(!this.max){
this.max=element.getAttribute('max');
};
if(!this.min){
this.min=element.getAttribute('min');
};
if(!this.regexp){
this.regexp=this._getRegEx(element);
};
if(element.checked){
this.values[this.values.length]=element.value;
};
this.elements[this.elements.length]=element;
};
Field1.prototype.IsValid=function(arrFields){
switch(this.type){
case "textarea":
case "password":
case "text":
case "file":
return this._ValidateText(arrFields);
case "select-one":
case "select-multiple":
case "radio":
case "checkbox":
return this._ValidateGroup(arrFields);
default:
return true;
};
};
Field1.prototype.SetClass=function(newClassName){
if((newClassName)&&(newClassName!="")){
if((this.elements)&&(this.elements.length>0)){
for(var i=0;i<this.elements.length;++i){
if(this.elements[i].className!=newClassName){
this.elements[i].oldClassName=this.elements[i].className;
this.elements[i].className=newClassName;
}
}
}else{
if(this.element.className!=newClassName){
this.element.oldClassName=this.element.className;
this.element.className=newClassName;
}
};
}
};
Field1.prototype.ResetClass=function(){
if((this.type!="button")&&(this.type!="submit")&&(this.type!="reset")){
if((this.elements)&&(this.elements.length>0)){
for(var i=0;i<this.elements.length;++i){
if(this.elements[i].oldClassName){
this.elements[i].className=this.elements[i].oldClassName;
}
else{
this.element.className="";
}
}
}else{
if(this.elements.oldClassName){
this.element.className=this.element.oldClassName;
}
else{
this.element.className="";
}
};
};
};
Field1.prototype._getRegEx=function(element){
regex=element.regexp||element.getAttribute('regexp')
if(regex==null)return null;
retype=typeof(regex);
if(retype.toUpperCase()=="FUNCTION")
return regex;
else if((retype.toUpperCase()=="STRING")&&!(regex=="JSVAL_RX_EMAIL")&&!(regex=="JSVAL_RX_TEL")
&&!(regex=="JSVAL_RX_PC")&&!(regex=="JSVAL_RX_ZIP")&&!(regex=="JSVAL_RX_MONEY")
&&!(regex=="JSVAL_RX_CREDITCARD")&&!(regex=="JSVAL_RX_POSTALZIP"))
{
nBegin=0;nEnd=0;
if(regex.charAt(0)=="/")nBegin=1;
if(regex.charAt(regex.length-1)=="/")nEnd=0;
return new RegExp(regex.slice(nBegin,nEnd));
}
else{
return regex;
};
};
Field1.prototype._ValidateText=function(arrFields){
if((this.required)&&(this.callback)){
nCurId=this.element.id?this.element.id:"";
nCurName=this.element.name?this.element.name:"";
eval("bResult = "+this.callback+"('"+nCurId+"', '"+nCurName+"', '"+this.value+"');");
if(bResult==false){
return false;
};
}else{
if(this.required&&this.value<=0){
return false;
};
if(this.value&&(this.minLength&&this.value.length<this.minLength)){
return false;
};
if(this.value&&(this.maxLength&&this.value.length>this.maxLength)){
return false;
};
if(this.regexp){
if(!_checkRegExp(this.regexp,this.value))
{
if(!this.required&&this.value){
return false;
}
if(this.required){
return false;
}
}
else
{
return true;
};
};
if(this.equals){
for(var i=0;i<arrFields.length;++i){
var field=arrFields[i];
if((field.element.name==this.equals)||(field.element.id==this.equals)){
if(field.element.value!=this.value){
return false;
};
break;
};
};
};
if(this.required){
var fValue=parseFloat(this.value);
if((this.minValue||this.maxValue)&&isNaN(fValue)){
return false;
};
if((this.minValue)&&(fValue<this.minValue)){
return false;
};
if((this.maxValue)&&(fValue>this.maxValue)){
return false
};
};
}
return true;
};
Field1.prototype._ValidateGroup=function(arrFields){
if(this.required&&this.values.length==0){
return false;
};
if(this.required&&this.min&&this.min>this.values.length){
return false;
};
if(this.required&&this.max&&this.max<this.values.length){
return false;
};
return true;
};
function _handleError(field,strErrorMessage){
var obj=field.element;
strNewMessage=strErrorMessage+((field.realname)?field.realname:((obj.id)?obj.id:obj.name))+"\n";
return strNewMessage;
};
function _throwError(field){
var obj=field.element;
switch(field.type){
case "text":
case "password":
case "textarea":
case "file":
//alert(_getError(field,"err_enter"));
document.getElementById("ErrorMessage").innerHTML=_getError(field,"err_enter");
try{
obj.focus();
}
catch(ignore){}
break;
case "select-one":
case "select-multiple":
case "radio":
case "checkbox":
//alert(_getError(field,"err_select"));
document.getElementById("ErrorMessage").innerHTML=_getError(field,"err_enter");
break;
};
};
function _getError(field,str){
var obj=field.element;
strErrorTemp=(field.err)?field.err:_getLanguageText(str);
idx=strErrorTemp.indexOf("\\n");
while(idx>-1){
strErrorTemp=strErrorTemp.replace("\\n","\n");
idx=strErrorTemp.indexOf("\\n");
};
return strErrorTemp.replace("%FIELDNAME%",(field.realname)?field.realname:((obj.id)?obj.id:obj.name));
};
function _parseBoolean(value){
return !(!value||value==0||value=="0"||value=="false");
};
function _checkRegExp(regx,value){	
switch(regx){
case "JSVAL_RX_EMAIL":
//return((/^[a-zA-ZüöäßÄÖÜ]+([\.-]?[a-zA-ZüöäßÄÖÜ]+)*@[a-zA-ZüöäßÄÖÜ]+([\.-]?[a-zA-ZüöäßÄÖÜ]+)*(\.\w{2,5})+$/).test(value));
case "JSVAL_RX_TEL":
return((/^1?[\-]?\(?\d{3}\)?[\-]?\d{3}[\-]?\d{4}$/).test(value));
case "JSVAL_RX_PC":
return((/^[a-z]\d[a-z]?\d[a-z]\d$/i).test(value));
case "JSVAL_RX_ZIP":
return((/^\d{5}$/).test(value));
case "JSVAL_RX_MONEY":	
	return((/^[0-9]+(\.[0-9]+)?$/).test(value));
case "JSVAL_RX_CREDITCARD":
return(!isNaN(value));
case "JSVAL_RX_POSTALZIP":
if(value.length==6||value.length==7)
return((/^[a-zA-Z]\d[a-zA-Z] ?\d[a-zA-Z]\d$/).test(value));
if(value.length==5||value.length==10)
return((/^\d{5}(\-\d{4})?$/).test(value));
break;
default:
return(regx.test(value));
};
};

/* Admin section mark asset as inappropiate*/
function markAssetAs(url,event){	
	clearDivHeading();
	screenWidth1 	= screenWidth();
	screenHeight1 	= screenHeight();
	scrollWidth1 	= scrollWidth();
	scrollHeight1 	= scrollHeight();
	popupWidth		= 540;
	popupHeight		= 100;
	
	scrollHeight1 += screenHeight1/2 - popupHeight;

	x = (screenWidth1-popupWidth)/2;
	y = (scrollHeight1);	
	
	var buyItDiv = document.getElementById('buyItDiv');
	if (!buyItDiv) {
		buyItDiv = createBuySellDiv();
	}
	var buyDiv = document.getElementById('buyDiv');
	buyItDiv.style.width=popupWidth+'px';
	buyItDiv.style.left=x+'px';
	buyItDiv.style.top=y+'px';
	buyItDiv.style.display='';
	buyDiv.style.width=popupWidth+'px';
	buyDiv.innerHTML = waitDiv();
	ajax_do_call(url,'','',changeMarkAsLink);	
}

function changeMarkAsLink(output)
{	
	var mySplitResult = output.split('~~~###');
	
	if(mySplitResult[3])
	{
		setDivContent("Successfuly mark asset as "+mySplitResult[2]);
		document.getElementById('DivMarkAs'+mySplitResult[1]).innerHTML ='';
		document.getElementById('DivMarkAs'+mySplitResult[1]).innerHTML =mySplitResult[0];	
	}else	
		setDivContent("Some information is missing, please Refresh the page."+output);		
}
/* Admin section mark asset as inappropiate*/
function vote(PATH,id,assettype,vote_type){
	
		var url			=PATH;
		var postVars	='&id='+ id +'&asset_type='+assettype +'&updown='+vote_type;
		var fuseAction	='';
		ajax_do_call(url,fuseAction,postVars,refreshThumb);
		
	}
	function refreshThumb(output){
		divId	=	output.split("_::_");
		document.getElementById('divThumbs'+divId[1]).innerHTML='<img src="' + baseURL + '/images/loading.gif" alt="Loading" />';
		document.getElementById('divThumbs'+divId[1]).innerHTML=divId[0];
		
	}
	function getLocalized(CountryCode){
			
			var url=baseURL+"/index.php?Action=weblo.getTopVotedAssets&CountryCode="+CountryCode;
			var fuseAction='';
			var postVars='';
			document.getElementById('divLocalized').innerHTML = '<div style="padding-top:60px; text-align:center;" ><img src="' + baseURL + '/images/loading.gif" alt="Loading" /><br /> Loading ...</div>';
			ajax_do_call(url,fuseAction,postVars,getTopVotedResult);
			
		}
	function getTopVotedResult(output){
	
		document.getElementById('divLocalized').innerHTML=output;
		}
		
		
 	function getLocalizedPopUp(url2go,countryCode){
		var dObj = document.getElementById("divLocalizedPopup");
		dObj.style.display = "block";
		//dObj.innerHTML="loading...";
		dObj.innerHTML='<div style="padding-top:130px; text-align:center;" ><img src="' + baseURL + '/images/loading.gif" alt="Loading" /><br /> Loading ...</div><!--[if lte IE 7]><iframe style="overflow-x: hidden; overflow-y: scroll; "scrolling="auto"></iframe><![endif]-->';
		url2go = escape(unescape(url2go));
		var url=baseURL+"/index.php?Action=weblo.getTopVotedAssetsPopUp&CountryCode="+countryCode+"&url2go="+url2go;

		var fuseAction='';
		var postVars='';
		ajax_do_call(url,fuseAction,postVars,localizePopup);
	  }
	function localizePopup(content)
	{
	var dObj = document.getElementById("divLocalizedPopup");
	

		var str = "";
		
		str += "<div class=\"bd\" id=\"closeImgLocalDiv\" align=\"right\">";
		str += "<img id=\"closeImgLocal\" src=\""+baseURL+"/images/close.gif\" alt=\"Close\" title=\"Close\" onclick=\"javascript:closeLocalizePopUp();\" />";
		str += "</div>";
		str += "<div class=\"bd\" id=\"popContentLocal\" style=\"padding : 0px 8px; 8px 8px; margin: 0px;\">";
			str += content;
		str += "</div> <!--[if lte IE 7]><iframe></iframe><![endif]-->";

		dObj.innerHTML = str;
	
	dObj.style.display = "block";
	if (document.getElementById("divCompare")!=null){
		if (document.getElementById("divCompare").style.display=='block'){
			document.getElementById("divCompare").style.display='none';	
		}
	}
}
function closeLocalizePopUp(){
	var dObj = document.getElementById("divLocalizedPopup");
	dObj.innerHTML = '';
	
	dObj.style.display = "none";
	}	
	
	function compareCountries(countryCode){
		

			var url=baseURL+"/index.php?Action=weblo.getComparePopUp&countryCode="+countryCode;
			var fuseAction='';
			var postVars='';
			ajax_do_call(url,fuseAction,postVars,comparePopUp);
		}

function comparePopUp(content)
	{
		//loading.gif
		var dObj = document.getElementById("divCompare");
		var str = "";
		
		str += "<div id=\"popContentCompare\">";
			str += content;
		str += "</div><!--[if lte IE 7]><iframe></iframe><![endif]-->";
		dObj.innerHTML = str;
		dObj.style.display = "block";
		if (document.getElementById("divLocalizedPopup")!=null){
			if (document.getElementById("divLocalizedPopup").style.display=='block'){
				document.getElementById("divLocalizedPopup").style.display='none';	
			}
		}
		compareCountry(document.getElementById('country').value);
}

function compareCountry(countryCode){	
	if (countryCode==undefined){		
		countryCode = "CA";	
	}
	
	var url=baseURL+"/index.php?Action=weblo.getComparePopUp&countryCode="+countryCode+"&compare=1";

	var fuseAction='';
			var postVars='';
			ajax_do_call(url,fuseAction,postVars,countryInfo);
	}
	function countryInfo(output){
		document.getElementById('divCompare').style.display='block';
		document.getElementById('countryInfo').innerHTML=output;
	}
	function closePopUpCompare(){
		document.getElementById('divCompare').style.display='none';
		}
//-----------------------Local Info --------------------------------------------------------
function getRelatedData(dataToGet,type,postStr){
	
			var url=baseURL+"/index.php?Action=weblo.getRelatedLocalData&dataToGet="+dataToGet+"&type="+type+"&"+postStr;

			var fuseAction='';
			var postVars='';			
			var loadingImg='<div style="text-align:center;  margin-top:50px;" ><img src="' + baseURL + '/images/loading.gif" alt="Loading" /></div>';		
			if (type=='Community'){
				document.getElementById('divCommunity').innerHTML =loadingImg;	
			}
			if (type=='states'){
				document.getElementById('divStates').innerHTML =loadingImg;	
			}
			if (type=='cities'){
				document.getElementById('divCities').innerHTML =loadingImg;	
			}
			if (type=='properties'){
				document.getElementById('divProperties').innerHTML =loadingImg;	
			}
			if (type=='celebrities'){
				document.getElementById('divCelebrities').innerHTML =loadingImg;	
			}
			if (type=='domains'){
				document.getElementById('divDomains').innerHTML =loadingImg;	
			}
		//alert(url);
			ajax_do_call(url,fuseAction,postVars,localInfo);
	}
	function localInfo(result){		
		divData = result.split('__:::__');		
		if (divData[1]=='Community'){
		
			document.getElementById('divCommunity').innerHTML=divData[0];	
		}
		if (divData[1]=='states'){
			document.getElementById('divStates').innerHTML=divData[0];	
		}
		if (divData[1]=='cities'){
			document.getElementById('divCities').innerHTML=divData[0];	
		}
		if (divData[1]=='properties'){
			document.getElementById('divProperties').innerHTML=divData[0];	
		}
		if (divData[1]=='celebrities'){
			document.getElementById('divCelebrities').innerHTML=divData[0];	
		}
		if (divData[1]=='domains'){
			document.getElementById('divDomains').innerHTML=divData[0];	
		}
		
	}
//-----------------------Local Info --------------------------------------------------------

function changeDropDownColor(obj, flag){
	if (flag == 1) {
		obj.className="mouseOverCSS";
	} else {
		obj.className="mouseOutCSS";
	}
}
