/* Used for expanding and collapsing of divs */
var gURL = '/';
var iURL = '/allImages';
YAHOO.namespace("menu");
YAHOO.namespace("onyomo.list");
function expand(elem, fromLength, toLength){
	var myAnim;
	if(document.getElementById(elem+'Expand').src.toString().match('collapse.gif')){
		myAnim = new YAHOO.util.Anim(elem, { height: {from: toLength*1.231,to: fromLength*1.231, unit: 'em' }}, 0.5, YAHOO.util.Easing.easeOut);
		document.getElementById(elem+'Expand').src = gURL+'images/expand.gif';
		document.getElementById(elem+'Expand').title = 'Click to see more options';
	}else{
		myAnim = new YAHOO.util.Anim(elem, { height: {from: fromLength*1.231,to: toLength*1.231, unit: 'em' }}, 0.5, YAHOO.util.Easing.easeOut);
		var fullView = function(){
			YAHOO.util.Dom.setStyle(elem,'height','auto');
		};
		myAnim.onComplete.subscribe(fullView);
		document.getElementById(elem+'Expand').src = gURL+'images/collapse.gif';
		document.getElementById(elem+'Expand').title = '';
	}
	myAnim.animate();
}

function promptInputBox(box){
	var inputBox = document.getElementById(box)
	var title = inputBox.title;
	
	YAHOO.util.Event.addListener(inputBox, "focus", function(){
			if(inputBox.value == inputBox.title){
				inputBox.value = ''
			}
			YAHOO.util.Dom.setStyle(inputBox, 'color', '#000000');
		}
	);
	
	YAHOO.util.Event.addListener(inputBox, "blur", function(){
			if(inputBox.value == inputBox.title || YAHOO.lang.trim(inputBox.value) == '' ){
				inputBox.value = inputBox.title;
				YAHOO.util.Dom.setStyle(inputBox, 'color', '#666666');
			}
		}
	);
	
	if(inputBox.value == '' || inputBox.value == inputBox.title){
		YAHOO.util.Dom.setStyle(inputBox, 'color', '#666666');
		inputBox.value = title;	
	}
	
}

/* Utility methods */
//Sets a cookie with Name, value and expiration parameters
function setCookie(name,value,days){
	var expires = "";
	if (days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	document.cookie = name+"="+value+expires+"; path=/;";
}

//Get values from a cookie. thus getCookie('S') returns the value of the cookie Named 'S'
function getCookie(cookieName)	{
	var cookies = document.cookie;
	if (cookies.length === 0){
		return "";
	}
	cookies = cookies.split(";");
	var cookieValue = "";
	for (var i=0; i<cookies.length; i++)
		if (cookies[i].indexOf(cookieName+"=") != -1)	{
			if (cookies[i].substring(0, cookies[i].indexOf(cookieName+"=")).length > 2){
				continue;
			}
			cookieValue = cookies[i].substring(cookies[i].indexOf("=")+1);
		}
	return cookieValue;
}

// opens invite window
function invite(){
	window.open ("invite.html","mywindow","dependent=yes, menubar=1,resizable=1,width=550,height=400 toolbar=0,location=0,menubar=0,titlebar=no");
}

// opens feedback window
function feedback(){
	var url = 'http://www.kampyle.com/feedback_form/ff-feedback-form.php?site_code=5584800&form_id=8243&lang=en';
	window.open(url+'&url='+window.location.href, 'kampyle_ff','left='+((window.screenX||window.screenLeft)+10)+',top='+((window.screenY||window.screenTop)+10)+',height=502px,width=440px,resizable=false');
}

// opens picture window
function picChange(){
	window.open ("picture.html","mywindow","dependent=yes, menubar=0,resizable=0,width=550,height=200 toolbar=0,location=0,menubar=0,titlebar=no");
}
/* End Utility methods */

/* Validaton Methods */
function isValidEmail(str) {
	return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/);
}

function isValidMobileNo(str){
	return str.match(/^9(0|1|2|3|4|5|6|7|8|9){9}$/);
}

function isValidPinCode(str){
	return str.match(/^(0|1|2|3|4|5|6|7|8|9){6}$/);
}
/* End of validation methods */
function populateExample(d){
	var locations = new Array();
	locations['delhi']='e.g Green Park or, 110016';
	locations['bangalore'] ='e.g Koramangala';
	locations['mumbai'] ='e.g Bandra West';
	locations['chennai'] ='e.g T Nagar';
	locations['jaipur'] ='e.g Malviya Nagar';
	locations['kolkata'] ='e.g Salt Lake';
	locations['pune'] ='e.g Pune Camp';
	locations['goa'] ='e.g Panaji';
	locations['jaipur'] ='e.g M I Road';
	locations['hyderabad'] ='e.g Banjara Hills';
	locations['ahmedabad'] ='e.g.Satellite';
	locations['chandigarh'] ='e.g Sector 35';
	locations['indore']='e.g Meghdoot Complex';
	locations['surat']='e.g bunglo road';
	locations['lucknow']='e.g Near Hanuman Mandir';
	locations['nagpur']='e.g Near Fawara Square';
	locations['bhopal']='e.g Hamidia Road';
	locations['agra']='e.g Mahatma Gandhi Rd.';
	locations['cochin']='e.g Gabriels, MG Rd, Ernakulam.';
	locations['jodhpur']='e.g Chopasani Rd';
	locations['kanpur']='e.g Gandhi Gram';
	locations['ludhiana'] = 'e.g Model Town';
	locations['udaipur'] = 'e.g Bhatt Ji Ki Barri';
	locations['vadodara'] = 'e.g Tilak Road';
	locations[''] = 'e.g. MG Road';
	var locExamples = document.getElementById('a');
	
	try{
		locExamples.value = locations[d];
	}catch(e){
		// do nothing
	}
	
	try{
		document.getElementById('a').title = locations[d];
		promptInputBox('a')
	}catch(e){
		// do nothing
	}

}

function validateSearchForm(e){
	var searchBox = document.getElementById('lookingForBox');
	if(YAHOO.lang.trim(searchBox.value).length == 0 || YAHOO.lang.trim(searchBox.value)==searchBox.title){
		document.getElementById('lookingForMessage').innerHTML = 'Enter search term';
		YAHOO.util.Event.stopEvent( e );
		return false;
	}
	var city = getCookie('CITY');
	if(!(city && city.length > 0)){
		document.getElementById('lookingForMessage').innerHTML = 'Select city';
		YAHOO.util.Event.stopEvent( e );
		return false;
	}
	var locBox = document.getElementById('a');
	if(YAHOO.lang.trim(locBox.value).indexOf('e.g')==0){
		locBox.value = '';
	}
	
	return true;
	
}

function bookMovie(){
	if (getCookie('EH')==''){
		alert("Please sign in to book movie tickets");
		return false;
	}
	return true;
}

/*
 * Create a new XMLHttpRequest object, Hanldes the browser inconsistencies.
 */
function getXmlHttpRequestObject(){
	var requestObj = null;
	try {
		requestObj = new XMLHttpRequest();
	} catch (ie) {
		try {
			requestObj = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (ie1) {
			try {
				requestObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				// do nothing
			}
		}
	}
	return requestObj;
}

/*********************************login.js*************************************************************
 LOGIN.JS
 ********************************************************************************************************/
function getUserName(){
	if(getCookie('EH')!=''){
		return getCookie('email');
	}
	return null;
}

function getEmailId(){
	if(getCookie('EH')!=''){
		return getCookie('userName');
	}
	return null;
}

function populateUserSpan(){
	// this does not throws any exception as this is mostly called in onload event along with other methods.

	try{
		updateUserPanel();
	}catch( e){
		// do nothing
	}
    
	try{
		var userName = getUserName();
		var span = document.getElementById("user");
        
		if(!span){
			span = document.getElementById('user');
		}
		if(!userName){
			span.innerHTML = '<a href="javascript:authenticate()">Login</a><span style="color:#ffffff">&nbsp;|&nbsp;</span><a href="./register.html">Register</a>';
		} else {
			span.innerHTML = 'Welcome <a href="./profile.html">'+userName + '</a>, <a href="./login.html?Login=2">Logout</a>';
		}
	} catch( e ){

	}
}

function getLoginFormText(){
	var formString = '';
	formString += '<form name="loginForm" method="POST" onsubmit="return login()">';
	formString += ' 	<table cellspacing="0">';
	formString += '		<tr bgcolor="#f9fafb">';
	formString += '			<td colspan=3 class="text" style=""><b>Sign into OnYoMo</b></td>';
	formString += '			<td colspan=1 align="right"><a href="javascript:closeLoginLayer()" style="padding-right:4px;font-weight:bold;">x</a></td>';
	formString += '		</tr>';
	formString += '<tr>' +
				  '<td style="width:44px;padding:0px;padding-top:1px"><img src="'+iURL+'/onyomoHeaderlogoLeft_review.gif" style="position:relative; top:-1px;" /></td>' +
				  '<td colspan=2 background="'+iURL+'/onyomoHeaderlogoCenter_review.gif" style="background-repeat:repeat-x;width:245px;" align="right"></td>' +
				  '<td style="width:50px;padding:0px;padding-top:1px"><img src="'+iURL+'/onyomoHeaderlogoRight_review.gif" style="position:relative; top:-1px;"/></td>' +
				  '</tr>';
	formString += '		<tr>';
	formString += '			<td></td>';
	formString += '			<td>User Id</td>';
	formString += '			<td><input type="text" id="userName" name="user" class="subtleInput" style="width:160px"></td>';
	formString += '			<td></td>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td colspan="2"/>';
	formString += '			<td class="errorText"><div id="usernameErrMsg"/></td>';
	formString += '			<td/>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td></td>';
	formString += '			<td class="text">Password</td>';
	formString += '			<td><input type="password" id="passwd" name="passwd" class="subtleInput" style="width:160px"></td>';
	formString += '			<td></td>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td colspan="2"/>';
	formString += '			<td class="errorText"><div id="passwordErrMsg"></div><a href="javascript:forgotPassword()" style="font-size:93%">forgot your password?</a></td>';
	formString += '			<td/>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td></td>';
	formString += '			<td style="border-top:1px solid #EAEAEA;padding-top:4px"></td>';
	formString += '			<td style="border-top:1px solid #EAEAEA;padding-top:4px"><input type="submit" value="Sign In" name="Sumbit" class="subtleButton">&nbsp;<input type="button" value="Cancel" onclick="javascript:closeLoginLayer()" class="subtleButton"></td>';
	formString += '			<td></td>';
	formString += '		</tr>';
	formString += '		<tr valign="bottom">';
	formString += '			<td></td>'
	formString += '			<td colspan=3 style="padding-top:10px;padding-bottom:5px;text-align:center;"><a href="'+gURL+'register.html">Register</a> now</td>';
	formString += '		</tr>';
	formString += '		</table>';
	formString += '		</form>';
	return formString;
}

function login(){
	document.getElementById('usernameErrMsg').innerHTML = '';
	document.getElementById('passwordErrMsg').innerHTML = '';

	var userName = document.getElementById("userName").value;
	var password = document.getElementById("passwd").value;
	var rememberMe = false;
	
	var reqFields = true;
	
	if(userName==''){
		document.getElementById('usernameErrMsg').innerHTML = "Enter your user id";
		reqFields = false;
	}
	if(password==''){
		document.getElementById('passwordErrMsg').innerHTML = "Enter your password";
		reqFields = false;
	}
	if(!reqFields){
		return false;
	}
	
	function loginSuccess(o){
		if(o.responseText.indexOf('true') != -1){
			window.location.reload();
		} else {
			document.getElementById("passwd").value = '';
			document.getElementById('usernameErrMsg').innerHTML = '';
			document.getElementById('passwordErrMsg').innerHTML = "Invalid user id or password";
		}
	}

	function loginFailure(){
		alert("an error occured while login");
	}

	authenticateUser(userName, password, rememberMe, loginSuccess, loginFailure)
	
	return false;
}

function closeLoginLayer(){
	var myDiv = document.getElementById("login1");
	myDiv.parentNode.removeChild(myDiv)

}

function authenticate(){
	
	var myDiv = document.getElementById("user");
	var loginDiv = document.createElement("div");
	myDiv.parentNode.insertBefore(loginDiv,myDiv);
	loginDiv.id = "login1";
    loginDiv.style.background = "#FFFFFF";
    loginDiv.style.zIndex = 20000;
    loginDiv.style.position = "absolute";

    loginDiv.style.left = Math.max(YAHOO.util.Dom.getViewportWidth()/2 - 150,50) + "px";
    loginDiv.style.top = Math.max(YAHOO.util.Dom.getViewportHeight()/2-150,100) + "px";
    loginDiv.style.border = "#2D64A8 2px solid";
    loginDiv.innerHTML = getLoginFormText();
    
    document.getElementById('userName').focus();
}

function authenticateUser(userName, password, rememberMe, successCallback, failureCallback){
	var callback = {
		success: successCallback,
		failure: failureCallback
	};
	var url = gURL+"login.html";
	var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, "Login=1&user="+escape(userName)+"&passwd="+escape(password)+"&rememberMe="+escape(rememberMe));
}

function updateUserPanel(){
	var userBox = document.getElementById('userPanel');

	if(userBox){
		var userName = getUserName();
		if(userName){
			document.getElementById('userPanelPic').src = "http://10.76.6.1/userpics/"+ getCookie('pic') + '.jpg';
			document.getElementById('userPanelUserName').innerHTML = "<a href='./profile.html'>"+userName+"</a>";
			document.getElementById('userPanelUserPoints').innerHTML = getCookie('pt');
		}else {
			document.getElementById('userPanelUserName').innerHTML = 'Guest';
			document.getElementById('userPanelUserPoints').innerHTML = 'Login';
		}
	}
}

function getForgotFormText(){
	var formString = '';
	formString += '<form name="loginForm" method="POST" onsubmit="return forgot()">';
	formString += ' 	<table cellspacing="0">';
	formString += '		<tr bgcolor="#f9fafb">';
	formString += '			<td colspan=3 class="text" style=""><b>Forgot Password</b></td>';
	formString += '			<td colspan=1 align="right"><a href="javascript:closeForgotPasswordBox()" style="padding-right:4px;font-weight:bold;">x</a></td>';
	formString += '		</tr>';
	formString += '<tr>' +
				  '<td style="width:44px;padding:0px;padding-top:1px"><img src="./allImages/onyomoHeaderlogoLeft_review.gif" style="position:relative; top:-1px;" /></td>' +
				  '<td colspan=2 background="./allImages/onyomoHeaderlogoCenter_review.gif" style="background-repeat:repeat-x;width:245px;" align="right"></td>' +
				  '<td style="width:50px;padding:0px;padding-top:1px"><img src="./allImages/onyomoHeaderlogoRight_review.gif" style="position:relative; top:-1px;"/></td>' +
				  '</tr>';
	formString += '		<tr>';
	formString += '			<td></td>';
	formString += '			<td colspan=2>Enter your email id below</td>';
	formString += '			<td></td>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td></td>';
	formString += '			<td colspan="2"><input type="text" id="userName" name="user" class="subtleInput" style="width:95%"></td>';
	formString += '			<td></td>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td colspan="2"/>';
	formString += '			<td class="errorText"><div id="usernameErrMsg"><span style="font-size:93%;color:#666666">we will email you the details</span></div></td>';
	formString += '			<td/>';
	formString += '		</tr>';
	formString += '		<tr>';
	formString += '			<td></td>';
	formString += '			<td style="border-top:1px solid #EAEAEA;padding-top:4px"></td>';
	formString += '			<td style="border-top:1px solid #EAEAEA;padding-top:4px"><input type="submit" value="Submit" name="Sumbit" class="subtleButton">&nbsp;<input type="button" value="Cancel" onclick="javascript:closeForgotPasswordBox()" class="subtleButton"></td>';
	formString += '			<td></td>';
	formString += '		</tr>';
	formString += '		<tr valign="bottom">';
	formString += '			<td></td>'
	formString += '			<td colspan=3 style="padding-top:10px;padding-bottom:5px;text-align:center;"><a href="./register.html">Register</a> now</td>';
	formString += '		</tr>';
	formString += '		</table>';
	formString += '		</form>';
	return formString;
}

function forgotPassword(){
	// close the login layer
	closeLoginLayer();
	
	var myDiv = document.getElementById("user");
	var loginDiv = document.createElement("div");
	myDiv.parentNode.insertBefore(loginDiv,myDiv);
	loginDiv.id = "forgot";
    loginDiv.style.background = "#FFFFFF";
    loginDiv.style.zIndex = 20000;
    loginDiv.style.position = "absolute";

    loginDiv.style.left = Math.max(YAHOO.util.Dom.getViewportWidth()/2 - 150,50) + "px";
    loginDiv.style.top = Math.max(YAHOO.util.Dom.getViewportHeight()/2-150,100) + "px";
    loginDiv.style.border = "#2D64A8 2px solid";
    loginDiv.innerHTML = getForgotFormText();
    
    document.getElementById('userName').focus();
}

function closeForgotPasswordBox(){
	// close the forgot password box
	var myDiv = document.getElementById("forgot");
	myDiv.parentNode.removeChild(myDiv)
}

function forgot(){
	document.getElementById('usernameErrMsg').innerHTML = '';

	var userName = document.getElementById("userName").value;
	
	if(userName==''){
		document.getElementById('usernameErrMsg').innerHTML = "Enter your email id";
		return false;
	}
	
	function forgotSuccess(o){
		var message = YAHOO.lang.JSON.parse(o.responseText);	
		if(message.status){
			document.getElementById('usernameErrMsg').innerHTML = "Password sent";
		} else {
			document.getElementById('usernameErrMsg').innerHTML = message.message;
		}
	}

	function forgotFailure(){
		alert("an error occured while retrieving password");
	}

	var callback = {
		success: forgotSuccess,
		failure: forgotFailure
	};
	var url = "./login.html";
	var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, "Login=resendPasswd&user="+escape(userName));
	
	return false;
}

function selectReplaceCity(obj){
	var div = '<div id="cityDropBox" class="yuimenubar yuimenubarnav"><div class="bd">';
	div += '<ul class="first-of-type"><li class="yuimenubaritem first-of-type">';
	div += '<a class="yuimenubaritemlabel" href="#" id="selectLabel">Select City</a>';
	div += '</li></ul></div></div>';
	obj.style.display = 'none';
	document.getElementById('cs').innerHTML = div;
	var opts = obj.options;
	var selectedOpt = (!obj.selectedIndex) ? 0 : obj.selectedIndex;
	var listArr = new Array();
	for (var i=1; i<opts.length; i++) {
	var list = '';
	if(i === selectedOpt){
		var tempArr = new Object();
		tempArr['text'] = opts[i].text;
		tempArr['checked'] = true;
		document.getElementById('selectLabel').innerHTML = opts[i].text;
		populateExample(opts[i].value);
		var url = "javascript:selectMe('";
		url += opts[i].value;
		url +="','";
		url += opts[i].text;
		url +="','";
		url += i;
		url += "');";
		tempArr['url'] = url;
		listArr[i] =  tempArr;
	}
	else{
		var tempArr = new Object();
		tempArr['text'] = opts[i].text;
		var url = "javascript:selectMe('";
		url += opts[i].value;
		url +="','";
		url += opts[i].text;
		url +="','";
		url += i;
		url += "');";
		tempArr['url'] = url;
		listArr[i] = tempArr;
	}
	}
	YAHOO.menu.oMenuBar = new YAHOO.widget.MenuBar("cityDropBox");
	var subMenu = [{id : "citySel",itemdata:listArr}];
	YAHOO.menu.oMenuBar.subscribe("beforeRender", function () { 
	if (this.getRoot() == this) { 
	this.getItem(0).cfg.setProperty("submenu", subMenu[0]);
	} 
	});
	
	YAHOO.menu.oMenuBar.render();
	YAHOO.menu.oMenuBar.show();
}
function selectMe(city,disCity,index){
setCookie('CITY',city);
populateExample(city);
var box = document.getElementById('citySelectElement');
box.selectedIndex = index;
document.getElementById('selectLabel').innerHTML = disCity;
var arr = YAHOO.menu.oMenuBar.getSubmenus(0);
var len = arr[0].getItems().length;
for (i=0;i<len;i++){
	arr[0].getItem(i).cfg.setProperty("checked",(i == (index-1)));
};
}
function setForm() {
	var s = document.getElementById('citySelectElement');
	selectReplaceCity(s);
}
function validateJumbleForm(){
	if (!getUserName()){
		document.getElementById('quizErrorDiv').innerHTML = 'Please <a href="javascript:authenticate()">Login</a> to play quiz';
		return false;
	}
	else if (document.getElementById('jumbleAnswerBox').value == ''){
		document.getElementById('quizErrorDiv').innerHTML = 'Please write your answer in the text box';
		return false;
	}
	else{
		var handleSuccess = function(o){
			response = o.responseText;
			document.getElementById('quizDataFeed').innerHTML = response;
		}
		var handleFailure = function(){
			alert('Some Problem')
		}
		formObject = document.getElementById('submitQuiz')
		YAHOO.util.Connect.setForm(formObject);
		var cObj = YAHOO.util.Connect.asyncRequest('POST','http://www.onyomo.com/jQ.html',{success:handleSuccess,failure:handleFailure});	
		return false;
	}
}

function createListDialogBox(divId,subjectId,subjectName,city,recordIndex){
	if (!getUserName()){
		document.getElementById('buttonContainer'+recordIndex).innerHTML = 'Please <a href="javascript:authenticate()">Login</a> to add.';
		return false;
	}
	if (YAHOO.onyomo.list.dialog){
		YAHOO.onyomo.list.dialog.cancel();
	}
	var handleSubmit = function(o){
		var handleSubmitSuccess = function(o){ 
			addDiv = document.getElementById('addToButtonDiv'+recordIndex);
			addDiv.style.display = 'none';
			document.getElementById('addToButtonDiv'+recordIndex).style.cursor = 'auto';
		}
		var handleSubmitFailure = function(o){
			alert('error');
		}
		formObject = document.getElementById("listForm"+'_'+recordIndex);
		frm = YAHOO.util.Connect.setForm(formObject);
		textBoxId = 'newListOption'+recordIndex;
		if((frm.indexOf('listId=&') > 0 || (frm.indexOf('listId')+7 == frm.length)) && document.getElementById(textBoxId).value==''){
			document.getElementById("listFormErrorDiv"+'_'+recordIndex).innerHTML = 'Please select a list or create a new one.';
			return false;
			}
		sUrl = 'http://www.onyomo.com/uList.html?action=submitUserList';
		var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,{success : handleSubmitSuccess,failure : handleSubmitFailure});
		this.cancel();	
	
	}
	
	var handleCancel = function(o){
		this.cancel();
	}
	var handleSuccess = function (o){
		data = o.responseXML;
		
		
		dialogMarkup = '<div id="dialogOverlay"><div class="hd">Add '+subjectName+' to list</div><div class="bd">';
		dialogMarkup += '<form method="POST" action="" id="listForm'+'_'+recordIndex+'" \>';
		dialogMarkup += '<div id="listFormErrorDiv'+'_'+recordIndex+'" style="color:#FF3333;text-align:center;margin-bottom:5px;font-size:11px;"></div>';
		dialogMarkup += '<input type="hidden" name="subjectId" value="'+subjectId+'"/>';
		dialogMarkup += '<input type="hidden" name="city" value="'+city+'"/>';
		dialogMarkup += '<input type="hidden" name="action" value="submitUserList"/>';
		if (data.getElementsByTagName('list').length>0){
		var listArr = data.getElementsByTagName('list');
		for (i=0;i<listArr.length;i++){
		dialogMarkup += '<div style="padding:3px 0px 3px 0px;"><input type="radio" name="listId" id="listOption'+i+'_'+recordIndex+'" value="'+listArr[i].getAttribute("id")+'"/>'+'<label for="listOption'+i+'_'+recordIndex+'" style="padding-left:3px;font-style:italic;">'+listArr[i].childNodes[0].nodeValue+'</label></div>'; 
		}
		}
		else{
		dialogMarkup += '<div style="padding:3px 0px 3px 0px;"><input type="radio" name="listId" id="listOptionBookmark'+recordIndex+'" value="0"/>'+'<label for="listOptionBookmark'+recordIndex+'" style="padding-left:3px;font-style:italic;">Bookmark</label></div>';
		}
		//how ? url to written here
		dialogMarkup += '<div style="padding:3px 0px 3px 0px;"><input type="radio" name="listId" id="listOptionText'+'_'+recordIndex+'" value="" checked/> or Create a new list <input type="text" name="listName" id="newListOption'+recordIndex+'" onfocus="setFocusForTextBox(\'listOptionText'+'_'+recordIndex+'\')" style="border:1px solid #999999;width:100px;"/><span style="margin-left:10px;nt-size:11px;font-style:italic;"><a href="">How ?</a></span></div>'; 
		document.getElementById(divId).innerHTML = dialogMarkup;
		YAHOO.onyomo.list.dialog = new YAHOO.widget.Dialog(divId, 
				{ width : "300px",
				  fixedcenter : true,
				  visible : true, 
				  constraintoviewport : true,
				  buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
									{ text:"Cancel", handler:handleCancel } ]
				 } );
		YAHOO.onyomo.list.dialog.render();
	};
	var handleFailure = function(o){
		alert('fail');
	};
	sUrl = 'http://www.onyomo.com/uList.html?action=getUserList';
	var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,{success : handleSuccess,failure : handleFailure});
}

function setFocusForTextBox(divId){
	document.getElementById(divId).checked = true;
}

function change_city() {
	YAHOO.menu.oMenuBar.getItem(0).cfg.getProperty("submenu").show();
}