var ajaxRequest = null;
var customerFName = null;
var records = null;

var toHideFlag = 1;
var intervalVal = 0;
var count = 0;
var callbackFlag = 1;
var callback1Flag = 1;

var clearPanel = null;
var loginTimer = 0;
var loginConfTimer = 0;
var blinkCursor = null;

var blinkStatus = true;
var bInterval = null;
var searchContent;

var pIndex = 0; // new page index 
var wIndex = 0; // new widgets index

var sComma = new Array();
var fString = new Array();
var inHindi = new Array();
var str = "";
var addString = ""; 

function setCookie(cookieName, cookieValue) {
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 10*365*86400); // 10 years
	top.document.cookie = cookieName + "=" + escape(cookieValue) + "; expires=" + expire.toGMTString();
}

function getCookie(cookieName) {
	var search = cookieName + "=";
	if (document.cookie.length > 0) { // if there are any cookies
		var offset = document.cookie.indexOf(search); 
		if (offset != -1) { // if cookie exists 
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1) 
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		} 
	}
}
function homePage() {
	window.location = './';
}
///////////////////////////////////////////
// function to create ajaxRequest using AJAX
function createRequest() {
	try {
		ajaxRequest = new XMLHttpRequest();
	} catch (trymicrosoft) {
   		try {
    		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
   		} catch (othermicrosoft) {
	 		try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
    	    	ajaxRequest = null;
    		}
  		}
	}
	if (ajaxRequest == null) {
//		alert("Error creating ajaxRequest object!");
	}
}

var abcit = null;
function loadingBefore(id, customerId) {
	setCookie("clId", customerId);
	getMessages(id);
}

function failureInfoMsg(str, id) {
	if (document.getElementById("startDiv")) {
		document.getElementById("startDiv").style.visibility = "hidden";
	}
	if (document.getElementById("loadImag")) {
		document.getElementById("loadImag").style.visibility = "hidden";
	}
	if (document.getElementById("failureInfoPanel")) {
		document.getElementById("failureInfoPanel").style.display = "block";
		document.getElementById("failureInfoPanel").innerHTML = '<table>'
														+ '<tr style="margin-top:-3px;"><td style="padding-left:5px;padding-right:7px;padding-top:0px;font-size:14px;width:250px;text-align:left;">'
														+ '<b></b></td>'
														+ '<td style="padding-left:5px;padding-top:0px;"></td>'
														+ '</tr>'
														+ '<tr><td colspan="2" style="padding-left:7px;padding-right:7px;padding-top:30px;font-size:20px;width:250px;text-align:center;"><div style="">' + str + '</div></td></tr>'
														+ '<tr><td colspan="2" style="padding-left:53px;padding-right:7px;padding-top:40px;font-size:14px;width:250px;text-align:center;"><div style="" ><input type="button" value="refresh" onClick="refreshFailureInfo();" style="background-color:#f69c53;width:88px;height:25px;"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></td></tr>'
														+ '</table>';
	}
}

function getMessages(id) {
	var locale = getCookie("locale");
	if(locale == null)
		locale = "en";
	var country = getCookie("country");
	var customerId = getCookie("customerId");
	var params = 'method=GETMESSAGES&code=' + locale + "&country=" + country + "&customerId=" + (!customerId ? -1 : customerId);
	createRequest();
	if(ajaxRequest == null) {
		return;
	}
	ajaxRequest.onreadystatechange = function() { 
		if (ajaxRequest.readyState == 4) {
	    	if(ajaxRequest.status == 200) {
	    			try {
	    				var response = (ajaxRequest.responseText).split("-?#-");
	    				try {
		    				records = YAHOO.lang.JSON.parse(response[0]);
	    				} catch(x) {
//	    					alert("error = " + x);
	    				}
		    			customerFName = response[1];
		    			loadingMain1(id);
	    			} catch(x) {
//	    				alert("viren " + x);
	    			}
			} else if(ajaxRequest.status == 500) { 
				failureInfoMsg("Network Failure!", id);
			}
		} 
	 };
	ajaxRequest.open("POST", '/OnlineAdmin', true);
	ajaxRequest.setRequestHeader("Content-Type" , "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	return false;
}

function loadingMain1(id) {
	loadingMain(id);
}


// Removes leading whitespaces
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}

// Removes ending whitespaces
function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

// Removes leading and ending whitespaces
function trim( value ) {
	return RTrim(LTrim(value));
}

var Event = YAHOO.util.Event,
	Dom   = YAHOO.util.Dom;
var wait = "";
var searchActive = false;

function loadingMain(id) {
try {
 	if(id != null || id != "") {
		var idMain = id;
		var id1 = id.substring(5, id.length);
		id = id.substring(0, 5);
		if(id == "login") {
			loginAuto(id1);
		} else {
		}
	}
	YAHOO.util.Get.css("./view/sms/yui/css/container.css");
	var sURL = [
				"./view/sms/yui/script/animation-min.js",
				"./view/sms/yui/script/element-beta-min.js",
				"./view/sms/yui/script/container-min.js",
//				"./view/sms/yui/script/utilities.js",
				"./view/online/script/prototype.js",
				"./view/online/script/js-core-min.js",
				"./view/online/script/dropdown.js",
				"./view/online/script/scroll.js",
				"./view/online/script/alert.js",
				"./view/online/script/md5.js",
				"./view/online/script/sha1.js"
//				"./view/online/yui/script/tabview-min.js"
		];
	var transactionObj = YAHOO.util.Get.script(sURL, { 
		onSuccess: function() {
			clearInterval(intervalVal);
			var username = getCookie("username");
			var password = getCookie("password");
			var customerId = getCookie("customerId");
			//alert(username + " : " + " : " + password + " : " + customerId);
			if(username != null && username != '' && password != null && password != '') {
				loadDynamicFiles(2, username, password, id, -1);
			} else {
				if(username != null) {
					loadDynamicFiles(2, username, password, id, 1);
				} else {
					loadContent("main", id, customerId);
				}
			}
		},   
		onFailure: function() {
			failureInfoMsg("Network Failure!");
		},   
		scope    : this  
	});
} catch (x) {
//	alert("begin exp " + x);
}
	return false;
}

function loginAuto(id) {
	var serverUrl="/OnlineAdmin";
	var params = "method=setLogin&username=" + id;
	createRequest();
	if(ajaxRequest == null) {
		return false;
	}
	ajaxRequest.onreadystatechange=function() {
		if (ajaxRequest.readyState == 4) {
			if(ajaxRequest.status == 0 || ajaxRequest.status == 12029 || ajaxRequest.status == 500 ) {
		  		failureInfoMsg("Network Failure!");
			}
			try{
				if(ajaxRequest.status == 200){
					if (document.getElementById("failureInfoPanel")) {
						document.getElementById("failureInfoPanel").style.display = "none";
					}
					var response = ajaxRequest.responseText;
					var customerId = response.substring(response.indexOf("$#")+ 2, response.length);
					response = response.substring(0, response.indexOf("$#"));
					setCookie("customerId", customerId);
					setCookie("liveWidget", true);
					document.location = '/';
				}
			}catch(x){
//				alert("error 3 = " + x);
				failureInfoMsg("Network Failure!");
			}
		}
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	 return false;
}
function closePanel() {
		signUpPanel.hide();
		return false;
}

var loaderPanel = "";
function loaderPanel1() {
	if (document.getElementById("loaderPanel")) {
		loaderPanel = new YAHOO.widget.Panel("loaderPanel",	
					{
						width: "32px", 
						height: "32px",
					  	fixedcenter: true, 
					  	underlay: "none", 
					  	close: false, 
                      	zindex: 200,
                      	constraintoviewport:true
					}	
				);
		Dom.setStyle("loaderPanel","background-image","url('/view/online/images/content/loader.gif')");
		loaderPanel.render(document.body);
	}
}	

function clearPwdPanel() {
	if(document.getElementById("loginInvalid")) {
		document.getElementById("loginInvalid").innerHTML ="";	
	}
}
function loadDynamicFiles(index, un, pwd, id, refreshIndex) {
//	alert(index + " *** "+ un + " ** "+ pwd + " *** "+ id );
	try {
	YAHOO.util.Get.css("./view/sms/yui/css/datatable.css");
	YAHOO.util.Get.css("./view/sms/yui/css/datatable-skin.css");
	YAHOO.util.Get.css("./view/online/yui/css/tabview.css");
	YAHOO.util.Get.css("./view/online/yui/css/calendar.css");
	YAHOO.util.Get.css("./view/util/yui/build/assets/skins/sam/skin.css");
	var sURL = [
				"./view/sms/yui/script/cookie-beta-min.js",
				"./view/online/script/ajaxCom.js",
				"./view/online/script/layout.js",
				"./view/online/script/tab.js",
				"./view/online/script/yuiPanel.js",
				"./view/sms/yui/script/utilities.js",
				"./view/sms/script/datatable-beta.js",
				"./view/online/yui/script/animation-min.js",
				"./view/online/script/akeeboPanel.js",
				"./view/online/script/validation.js",
				"./view/online/script/yuiPanel.js",
				"./view/online/script/widgets.js",
				"./view/online/script/login.js",
				"./view/online/script/swfobject.js",
				"./view/online/script/main.js",
				"./view/online/script/ajaxCom.js",
				"./view/online/script/fullGuide.js",
				"./view/online/script/alpha.js",
				"./view/online/script/stbConfig.js",
				"./view/online/embed/player/other/flowplayer-3.0.6.min.js",
				"./view/online/script/akeeboAds.js",
				"./view/online/script/video.js",
				"./view/online/script/live.js",
				"./view/online/script/login.js",
				"./view/online/yui/script/tabview-min.js",
				"./view/online/script/textChat.js",
				"./view/online/script/blog.js",
				"./view/online/script/weather.js",
				"./view/online/script/calendar.js",
				"./view/online/script/news.js",
				"./view/online/script/email.js",
				"./view/online/script/onDemand.js",
				"./view/online/script/games.js",
  				"./view/online/script/painAlert.js",
  				"./view/online/script/assignedPanel.js",
  				"./view/online/script/staffCom.js",
				"./view/online/script/meals.js",
			 	"./view/online/script/settings.js",
			  	"./view/online/script/spiritual.js",
			  	"./view/online/script/gameMenu.js",
			  	"./view/online/script/giftShop.js",
			  	"./view/online/script/transport.js",
			  	"./view/online/script/internetRadio.js",
			  	"./view/online/script/scCalculator.js",
			  	"./view/online/script/quizPanel.js",
			  	"./view/online/yui/script/editor-min.js",
			  	"./view/online/yui/script/menu-min.js"
		];
		
	var transactionObj = YAHOO.util.Get.script(sURL, { 
		onSuccess: function() {
			if(index == 1) {
				document.location = '/';
			} else if(index == 2){
				if( refreshIndex == 1) {
					var customerId = getCookie("customerId");
					loadContent("main", id, customerId);
				} else {
					loginRemember(un, pwd, id);
				}
			}
		},   
		onFailure: function() {
			failureInfoMsg("Network Failure!");
		},   
		scope    : this  
	});
	return false;
	} catch (x) {
//		alert("loading files " + x);
	}
}
function whySignUpPanel() {
	return false;
}
function userLogin(form) {

	var flag = 0;
	var locale = getCookie("locale");
//	alert(locale + ", the locale is: ");
	var user = "";
	var pass = "";
	if (locale == "zh" || locale == "hi") {
		user = toScript(records.key14);
		pass = toScript(records.key15);
	} else {
		user = records.key14;
		pass = records.key15;
	}
//	alert(form.username.value + "user name: " + form.password.value);
	try {
	if(form.username.value == "") {
//		alert("Please enter username");
		Alert.fnAlert(user, null, form.username);
		return false;
	}
	if(form.password.value == "") {
//		alert("Please enter password");
		Alert.fnAlert(pass, null, form.password);
		return false;
	}
	
	if(form.rememberMe.value != 'direct_login') {
		if(form.rememberMe.checked == true) {
			flag = 1;
		} 
	}
	
	//setCookie("liveWidget", "true", { expires: new Date("January 12, 2025") });
	var params='method=userLogin&username=' + form.username.value 
		+ '&password=' + hex_sha1(hex_md5(form.password.value)) ;
	loaderPanel1();
	var serverUrl="/OnlineAdmin";
	createRequest();
	if(ajaxRequest == null) {
		document.getElementById("content").innerHTML = "Loading...";
//		loadPage(pageName);  
		return false;
	}
	ajaxRequest.onreadystatechange=function() {
		if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			response = ajaxRequest.responseText;
//			alert(response);
			loaderPanel.hide();
			if(response != 1 && response != 2) {
				var customerId = response.substring(response.indexOf("$#")+ 2, response.length);
				response = response.substring(0, response.indexOf("$#"));
				if(flag == 1) {
					setCookie("customerId", customerId);
					setCookie("cRemember", customerId);
					setCookie("username", form.username.value);
					setCookie("password", form.password.value);
				} else {
					setCookie("customerId", customerId);
					setCookie("username", form.username.value);
				}
				updateUserStatus(1);
				setCookie("liveWidget", "true");
//				alert("username => " + form.password.value + " password => " + getCookie("password"));
				customerFName = response;
				loadDynamicFiles(1, form.username.value, form.password.value, "", -1);
				//loadDynamicFiles(2, form.username.value, form.password.value, "", -1);
			} else if(response == 2) {
				if(clearPanel != null) {
					top.window.clearTimeout(clearPanel);
					clearPanel = null;
				}
				document.getElementById("loginInvalid").innerHTML ='<P style="font-family:Trebuchet MS, calibri, verdana;"> '+ records.key1740 +'.</P';
				clearPanel = window.setTimeout('clearPwdPanel();',5000);
			} else {
				if(clearPanel != null) {
					top.window.clearTimeout(clearPanel);
					clearPanel = null;
				}
				document.getElementById("loginInvalid").innerHTML ='<P style="font-family:Trebuchet MS, calibri, verdana;">' + records.key13 + '</P';
				clearPanel = window.setTimeout('clearPwdPanel();',5000);
			}
		}
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	
	} catch(x) {
//		alert(" error 4= " + x);
	}
	return false;
}
function updateUserStatus (usrStatus) {
//	alert(2);
	var customerId = getCookie("customerId");
	if (customerId == null){
		usrStatus = 0;
	} else if(!customerId) {
		usrStatus = 0;
		return;
	}
//	alert(customerId + "customerId: " + usrStatus);
	var params = "method=updateLoginStatus&usrStatus=" + usrStatus + "&customerId="+ customerId + "&detectWebcam="+ detectWebcam; 
	var callbacks = { 
			    success : function (o) {
		        try {
//		        	alert(detectWebcam);
		        } catch (x) {
//		        	alert("error 5 = " + x);
		    		return; 
	      		}   
			}, 
			ailure: function(o) {
				failureInfoMsg("Network Failure!");
	    	}
		};			
	YAHOO.util.Connect.asyncRequest('POST',"/OnlineAdmin", callbacks, params);
	return false;
}

function loginRemember(username, password, id) {
	try {
	var locale = getCookie("locale");
	var user = "";
	var pass = "";
	var params='method=userLogin&username=' + username  
		+ '&password=' + hex_sha1(hex_md5(password));
	var serverUrl="/OnlineAdmin";
	createRequest();
	if(ajaxRequest == null) {
		return false;
	}
	ajaxRequest.onreadystatechange=function() {
		if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			response = ajaxRequest.responseText;
//			alert(response);
			if(response != 1) {
				var customerId = response.substring(response.indexOf("$#")+ 2, response.length);
				setCookie("customerId", customerId);
				loadContent("main", id, customerId);
			} else {
				if(clearPanel != null) {
					top.window.clearTimeout(clearPanel);
					clearPanel = null;
				}
				if(document.getElementById("loginInvalid")) {
					document.getElementById("loginInvalid").innerHTML = '<P style="font-family:Trebuchet MS, calibri, verdana;">' + records.key13 + '</P>';					
				}
				clearPanel = window.setTimeout('clearPwdPanel();',5*1000);
			}
		}
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	} catch(x) {
//		alert("error 6 = " + x);
	}
	return false;
}
function loadContent(page, id, customerId) {
	var serverUrl="/view/online/jsp/"+ page +".jsp";
	createRequest();	
	if(ajaxRequest == null)
		return;
	var params = "customerId=" + customerId;
	ajaxRequest.onreadystatechange = function() {
		paintContent(page, id, customerId);
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	return false;
}

function paintContent(page, id, customerId) {
	if(ajaxRequest.readyState == 4) {
		if(ajaxRequest.status == 0 || ajaxRequest.status == 12029 || ajaxRequest.status == 500 ) {
		  	failureInfoMsg("Network Failure!");
		}
		try{
			if(ajaxRequest.status == 200){
				if (document.getElementById("failureInfoPanel")) {
					document.getElementById("failureInfoPanel").style.display = "none";
				}
				if(document.getElementById("holder")) {
					document.getElementById("holder").innerHTML = ajaxRequest.responseText;
					try {
						layoutOnload(id);
					} catch(x) {
//						alert("exp " + x);
					}
//					alert(id);
					if(id != null && id != '') {
						var idMain = id;
						var id1 = id.substring(5, id.length);
						id = id.substring(0, 5);
						if(id == "login") {
//							alert(2);
							loginAuto(id1);
						} else {
//							alert(3);
							resetPasswordPage(idMain);	
						}
					}
					var username = getCookie("username");
					var password = getCookie("password");
					var cusID = getCookie("customerId");
					if(username != null && username != '' && password != null && password != '') {
//						alert(4);
						layoutOnload();	
					}
				} else {
					paintContent(page, id, customerId);
				}
			}
		}catch(x){
			failureInfoMsg("Network Failure!");
		}
	} 
	return false;
}

function layoutOnload(id) {
	lay(id);
	searchContent = document.getElementById("searchTitle").innerHTML;
	var customerId = getCookie('customerId');
	var sText = "";
	var params = "customerId=" + customerId + "&search=" + sText;
	if (customerId == null) {
		loadJspContent("sideWidgetAll");
	} else {
		loadJspContent("sideWidgets", params);
	}
	window.setInterval("getCurrentTime();", 1000);
	return false;
}

function lay(id) {
	try {
	var cusID = getCookie('customerId');
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version == 5.5) || (version == 6)) {
	} else {
   		setColor();
	}
	document.getElementById("logo").innerHTML = '<img id="logoImg" style="text-align:center;" title="organizing content & widgets around you!" onclick="return homePage();" src="./view/online/images/content/logo.png" alt=""/>';
//	alert("name = " + customerFName);
	if(cusID != null){
		document.getElementById("content").innerHTML = '<table style="outline:none;"><tbody><tr height="15px"> <td style="text-align:center;font-family:Trebuchet MS;font-size:38px;">'
 													+ trim(records.key55)+',&nbsp;'+ customerFName.toLowerCase() +'</td></tr><tr><td style="text-align:center;padding-top:30px;"><img src="./view/online/images/content/akeebo.gif"/></td></tr><tr><td  style="text-align:center;font-family:Trebuchet MS;font-size:22px;padding-top:10px;">organizing content & widgets around you!<span style="color:#a3a6ab;font-size:16px;vertical-align:top;text-align:left;"><img src="./view/online/images/content/r.gif"/></span></td></tr><tr><td style="text-align:center;padding-top:10px;"><img src="./view/online/images/content/akeebobox.jpg" alt=""/></td></tr><tr><td style="height:40px;"></td></tr>'
													+ '</tbody></table>';
	} else {
		document.getElementById("content").innerHTML = '<table style="outline:none;"><tbody><tr height="15px"> <td style="text-align:center;font-family:Trebuchet MS;font-size:48px;">'
													+ ((records != null && records.key944 != undefined) ? records.key944 : "welcome!" ) + '</td></tr><tr><td style="text-align:center;padding-top:30px;"><img src="./view/online/images/content/akeebo.gif"/></td></tr><tr><td  style="text-align:center;font-family:Trebuchet MS;font-size:22px;padding-top:10px;">organizing content & widgets around you!<span style="color:#a3a6ab;font-size:16px;vertical-align:top;text-align:left;"><img src="./view/online/images/content/r.gif"/></span></td></tr><tr><td style="text-align:center;padding-top:10px;"><img src="./view/online/images/content/akeebobox.jpg" alt=""/></td></tr><tr><td style="height:40px;"></td></tr>'
													+ '</tbody></table>';
	}
	} catch(x) {
//		alert(x);
	}
	
	try  {
	var _app = navigator.appName;
	if (_app == 'Netscape') {
		Dom.setStyle('rightTD', 'height', 32 + 'px');
		Dom.setStyle('leftTD', 'height', 32 + 'px');
		var widT = ((35/100)*Dom.getClientWidth());
		Dom.setStyle('lft', 'width', widT + 'px');
		Dom.setStyle('rft', 'width', widT + 'px');
		
		window.onrsize = function () {
			Dom.setStyle('rightTD', 'height', 32 + 'px');
			Dom.setStyle('leftTD', 'height', 32 + 'px');
			var widT = ((35/100)*Dom.getClientWidth());
			Dom.setStyle('lft', 'width', widT + 'px');
			Dom.setStyle('rft', 'width', widT + 'px');
		}
		Dom.setStyle('dPanel', 'margin-left', 74 + 'px');
	} else {
		var widT = ((35/100)*Dom.getClientWidth());
		var widTR = ((35/100)*Dom.getClientWidth());
		Dom.setStyle('lft', 'width', widT + 'px');
		Dom.setStyle('rft', 'width', widTR + 'px');
		Dom.setStyle('contentBody', 'margin-top', 0 + 'px');
		document.body.onresize = function (){
			var widT = ((35/100)*Dom.getClientWidth());
			var widTR = ((35/100)*Dom.getClientWidth()); 
			Dom.setStyle('lft', 'width', widT + 'px');
			Dom.setStyle('rft', 'width', widTR + 'px');
			Dom.setStyle('contentBody', 'margin-top', 0 + 'px');
		};
	}
	 
	Dom.setStyle('lft', 'background', '#fff9e9');
	Dom.setStyle('rft', 'background', '#fff9e9');
	Dom.setStyle('bodyMain', 'background', '#fff9e9');	
	
	document.getElementById("dPanel").style.visibility = "visible";
	Dom.removeClass(document.body, 'yui-skin-sam'); 
	Dom.setStyle('loadImag', 'display', 'none');
	document.getElementById("startDiv").innerHTML = "";
	Dom.setStyle('startDiv', 'padding-left', 0 + 'px');
	Dom.setStyle('startDiv', 'padding-top', 0 + 'px');
	document.getElementById('center2').style.visibility = 'visible';
	Dom.setStyle('footer', 'border-top', 5 + 'px solid #749649');
	Dom.setStyle('header', 'border-bottom', 5 + 'px solid #749649');
	} catch(x) {
//		alert(x);
	} 
	try {
		afterUpload();
	} catch(x) {
//			alert(x);
	}
	return false;
}
function afterUpload() {
	var sURL = [ 
			"./view/online/script/base64.js",
			"./view/online/script/usf8_decode.js"
	];
	
	var transactionObj = YAHOO.util.Get.script(sURL, { 
		onSuccess: function() {
			/*YAHOO.util.Get.css("./view/online/css/tutorsty.css");
			YAHOO.util.Get.css("./view/online/css/flexcrollie6styles.css");
			YAHOO.util.Get.css("./view/online/css/flexcrollstyles.css");*/
		},   
		onFailure: function() {
			failureInfoMsg("Network Failure!");
		},   
		scope    : this  
	});
	return false;
}

function setColor() {
	document.getElementById('terms').style.color = '#373737';
	document.getElementById('privacy').style.color = '#373737';
	document.getElementById('jobsA').style.color = '#373737';	
	document.getElementById('forLog').style.color = '#ffffff';
	Dom.setStyle("signupHide", "background-image", "none");
	Dom.setStyle("ok-button", "visibility", "hidden");
}

function loadJspContent(page, params) {
//	
	var serverUrl="./view/online/jsp/" + page + ".jsp";
	createRequest();	
	if(ajaxRequest == null)
		return;
		
	ajaxRequest.onreadystatechange = function() {
		paintJspContent(page, params);
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	return false;
}

function paintJspContent(page, params) {
	if(ajaxRequest.readyState == 4) { 
		if(ajaxRequest.status == 0 || ajaxRequest.status == 12029 || ajaxRequest.status == 500 ) {
		  	failureInfoMsg("Network Failure!");
		}
		try {
			if(ajaxRequest.status == 200) {
//				getFmsServer();
				if (document.getElementById("failureInfoPanel")) {
					document.getElementById("failureInfoPanel").style.display = "none";
				}
				if(page == "sideWidgetAll") {
					document.getElementById("sideBar").innerHTML = ajaxRequest.responseText;
				} else if(page == "sideWidgets") {
//					loginActive = true;
					document.getElementById("sideBar").innerHTML = ajaxRequest.responseText;
					//loadJspContent("akeeboAds");
				} else if(page == "loadPlayer") {
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
				} else if(page == "broadcastPage") {
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
				} else if(page == "audio") {
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
				} else if(page == "settings") {
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
				} else if(page == "akeeboAds") {
					document.getElementById("leftBar").innerHTML = ajaxRequest.responseText;		
				} else if(page == "customerDetails") { 
					loginActive = true;
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
				} else if(page == "showImage") { 
					document.getElementById("whySign").style.visibility = "visible";
					document.getElementById("showImage").innerHTML = ajaxRequest.responseText;
				} else if(page == "assignWidgets") { 
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
					getLocationProgramming();
				} else {
					getFmsServer();
					document.getElementById("content").innerHTML = ajaxRequest.responseText;
				}
			}
		}catch(x){
			failureInfoMsg("Network Failure!");
		}
	} 
	return false;
}
function resetPassword(form) {
	try {
	var locale = getCookie("locale");
	var user = "";
	if (locale == "zh" || locale == "hi") {
		user = toScript(records.key463);
	} else {
		user = records.key463;
	}
	if(form.username.value == "") {
		Alert.fnAlert(user, null, form.username);
		return false;
	}
	loaderPanel1();
	var params='method=forgotPassword&username=' + form.username.value;
	var serverUrl="/OnlineAdmin";
	createRequest();
	if(ajaxRequest == null) {
		document.getElementById("content").innerHTML = "Loading...";
		return false;
	}
	ajaxRequest.onreadystatechange=function() {
		if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			response = ajaxRequest.responseText;
//			alert(response);
			loaderPanel.hide();
			if(response == -1) {
				document.getElementById("forgotPassword").innerHTML ='<P style="font-family:Trebuchet MS, calibri, verdana;padding-left:180px;font-size:15px;padding-top:10px;">' + records.key1620 + '.</P>';
			} else {
				passwordAssistancePanel(); 
			}
		}
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	} catch(x) {
//		alert("error 7 =" + x);
	}
	return false;
}
function resetPasswordPage(id) {
 	setColor();
 	document.getElementById('terms').style.color = 'black';
 	document.getElementById('privacy').style.color = 'black';
 	document.getElementById('jobsA').style.color = 'black';
 	document.getElementById("content").innerHTML = "";
 	document.getElementById("content").innerHTML = '<form name="form" onsubmit="return resetForgotPassword(this);">' 
 				+ '<input type="hidden" name="username" id="username" value=' + id + '>'
				+ '<table style="width:800px;"> <tr> <td style="text-align:left;padding-top:120px; font:Trebuchet MS;padding-left:180px;font-size:36px;" align="center"> <b><em><p>' + 'reset password' + '</em></p> </td></tr>' 
				+ '<tr><td style="text-align:left;font:Trebuchet MS;font-size:15px;padding-top:10px;padding-left:180px;" valign="middle"> <table cellspacing="5"><b><em><tr><td width="170px;"> <label> ' + ' password  ' + ':</label><br/> <input type="password" id="password" name="password"  style="height:19px;" onFocus="searchContent1();"/></td>'
				+ '<td width="170px;"><label>' +  'password confirmation ' + ':</label> <br/> <input type="password" id="repassword" name="repassword" style="height:19px;" onFocus="searchContent1();"/></td>  '
				+ '<td style="font:Trebuchet MS;"> <br/><b> <input type="button" class="submitButton1" value= "reset password" onClick="return resetForgotPassword(form);"/></b></td>'
				+ '<td><br/> <input type="button" onClick="resetPasswordPage(this.form);" style="width:18px;background: url(./view/online/images/content/x.png);height:25px;border:0px solid #959593;margin-left:3px;"/> </td> </tr> </table> '
				+ '<div id="login" style="font-size:15px;color:red;padding-left:5px;"></div>'
				+ '<p> &nbsp; </p>' 
				+ '<p> &nbsp; </p>'
				+ '</b></em></td></tr></table>'
				+ '</form>';
	document.getElementById('password').focus();
}
function resetForgotPassword(form) {
	var locale = getCookie("locale");
	var password = "";
	var confirmPassword = "";
	var confirmPasswordNotMatched = "";
	if (locale == "zh" || locale == "hi") {
		password = toScript(records.key15);
		confirmPassword = toScript(records.key33);
		confirmPasswordNotMatched = toScript(records.key1615);
	} else {
		password = records.key15;
		confirmPassword = records.key33;
		confirmPasswordNotMatched = records.key1615;
	}
	if(form.password.value == "") {
		Alert.fnAlert(password, null, form.password);
		return false;
	}
	if(form.repassword.value == "") {
		Alert.fnAlert(confirmPassword, null, form.repassword);
	}
	if(form.password.value != form.repassword.value) {
		Alert.fnAlert(confirmPasswordNotMatched, null, form.password);
		return false;
	}
	loaderPanel1();
	
	var params='method=resetForgotPassword&username=' + form.username.value
		+ '&password=' + hex_sha1(hex_md5(form.password.value));
//	alert(params);
	var serverUrl="/OnlineAdmin";
	createRequest();
	if(ajaxRequest == null) {
		loadPage(pageName);  
		return false;
	}
	ajaxRequest.onreadystatechange=function() {
		if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			response = ajaxRequest.responseText;
			loaderPanel.hide();
			if(response == 1) 
				window.location = "/";
		}
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	return false;
}
function login() {
	try {
		searchContent1();
		hideScroll();
 		setColor();
	} catch(x) {
//		alert(" error 8 "+ x);
	}
	try {
// 	document.getElementById('terms').style.color = 'black';
 	document.getElementById('privacy').style.color = 'black';
 	document.getElementById('jobsA').style.color = 'black';
 	document.getElementById("content").innerHTML = "";
 	document.getElementById("content").innerHTML = '<form id="form" name="form" onsubmit="return userLogin(this);">' 
				+ '<table style="width:800px;font-family:Trebuchet MS;"> <tr><td style="text-align:right;padding-right:7px;padding-top:10px;font-size:15px;font-family:Trebuchet MS;"><a onClick="forgotPassword();" id="forPass" style="cursor:pointer;color:green;"> ' + records.key4 + '? </a> &nbsp;|&nbsp; <a onClick="signUp();" id="signUp" style="cursor:pointer;color:green;"> ' + records.key5 + ' </a></td></tr>' 
				+ '<tr> <td style="text-align:left;padding-top:130px; font:Trebuchet MS;padding-left:180px;font-size:36px;" align="center"> <b><em><p>' + records.key3 + '</em></p> </td></tr>' 
				+ '<tr><td style="text-align:left;font:Trebuchet MS;font-size:15px;padding-top:10px;padding-left:180px;" valign="middle"> <table cellspacing="5"><b><em><tr><td width="170px;"> <label> ' + records.key11 + ':</label><br/> <input type="text" id="username" name="username" tabIndex="1" style="height:20px;" onFocus="searchContent1();"/></td>'
				+ '<td id="passText" width="170px;"><label>' +  records.key12 + ':</label> <br/> <input type="password" id="password" name="password" tabIndex="2" style="height:20px;" onFocus="searchContent1();"/></td>  '
				+ '<div id="akeeboPanel"></div>'
				+ '<td style="font:Trebuchet MS;"> <br/> <input type="submit" class="submitButton1" value= ' + records.key3 + ' onClick="return userLogin(form);" tabIndex="3" /></td>'
				+ '<td> <br/> <input type="button" id="xButton" onClick="clearLogin1(this.form);" style="width:20px;background: url(./view/online/images/content/x.png);height:24px;border:0px solid #959593;margin-left:3px;" tabIndex="4"/> </td> </tr> </table> '
				+ '<p> &nbsp; </p>' 
				+ '<input type="checkbox" name="rememberMe" tabIndex="5"> ' + records.key44 + '<br/><br/>'
				+ '<div id="loginInvalid" style="font-size:15px;color:red;padding-left:5px;"></div>'
				+ '</b></em></td></tr></table>'
//				document.getElementById('username').focus();
				+ '</form>';
	var _app = navigator.appName;
	if (_app == 'Netscape') {
		document.getElementById('passText').style.width = "164px";
		Dom.setStyle('xButton', 'margin-left', 8 + 'px');
	}
	document.getElementById('username').focus();
	} catch(x) {
		alert("3 " + x);
	}
}

function searchContent1() {
	Dom.setStyle('searchTitle', 'padding-left', 0 + 'px');
	document.getElementById("searchTitle").innerHTML = searchContent;
	if(blinkCursor != null) {
		window.clearInterval(blinkCursor);
		blinkCursor = null;
	}
	textStatus = false;
	document.getElementById("blinkPanel").innerHTML = "";
	return false;
}
function getCurrentTime() {
	var nowTime = new Date();

	var nDay = nowTime.getDay();
	if (nDay==0)
		nDay="Sun";
	else if (nDay==1)
		nDay="Mon";
	else if (nDay==2)
		nDay="Tue";
	else if (nDay==3)
		nDay="Wed";
	else if (nDay==4)
		nDay="Thu";
	else if (nDay==5)
		nDay="Fri";
	else if (nDay==6)
		nDay="Sat";
	var nMonth = nowTime.getMonth();
	var nDate = nowTime.getDate(); 
	var nHours = nowTime.getHours();
	var nMinutes = nowTime.getMinutes();
	var nSecond = nowTime.getSeconds();
	nSecond = nSecond < 10 ? '0'+nSecond : nSecond;
	nDate = nDate < 10 ? '0'+nDate : nDate; 
	var hr = (nHours > 12) ? nHours - 12 : nHours;         
	hr = hr == 0 ? '12' : hr;
	var p = new String(":");
	var dayNdate = nDay + ", " + getMonthText(nMonth) + " " + nDate;
	document.getElementById("sTrayTime").innerHTML = dayNdate + "&nbsp;|&nbsp;"+hr + ((nMinutes < 10) ? ":0" : ":") + nMinutes + ":"+ nSecond + ((nHours >= 12) ? " PM" : " AM");  
}

function getMonthText(index) {
	return index == 0 ? "Jan" : (index == 1 ? "Feb" : (index == 2 ? "Mar" : (index == 3 ? "Apr" : (index == 4 ? "May" : (index == 5 ? "June" : (index == 6 ? "Jul" : (index == 7 ? "Aug" : (index == 8 ? "Sep" : (index == 9 ? "Oct" : (index == 10 ? "Nov" : (index == 11 ? "Dec" : "")))))))))));  
}
function forAnalytics() {
//	window.open("http://analytics.akeebo.com");
	window.location = 'http://analytics.akeebo.com';
	return false;
}

function forAds() {
//	window.open("http://ads.akeebo.com");
	window.location = 'http://ads.akeebo.com';
	return false;
}
function forCom() {
	window.location = 'http://online.akeebo.com';
}

function forTv() {
//	window.open('http://www.akeebo.tv');
	window.location = 'http://www.akeebo.tv';
}

function forMobi() {
//	window.open('http://www.akeebo.mobi');
	window.location = 'http://www.akeebo.mobi';
}

function forSms() {
//	window.open('http://sms.akeebo.com');
	window.location = 'http://sms.akeebo.com';
}
function toScript(getData) {
	if(!getData) {
		return;
	}
	var getSTR = "";
 	var cData = getData.split(' ');
 	for(var i = 0; i < cData.length; i++) {
 		cData[i] = cData[i].replace(/&#/g,'');
 		cData[i] = trim(cData[i]);
 	}
 	for(var j = 0; j < cData.length; j++) {
 		sComma = cData[j].split(",");
 		for(var k = 0; k < sComma.length; k++) {
 			addString = sComma[k].replace(/;/g,',');
 			addString = addString.substr(0,addString.lastIndexOf(','));
 			fString = addString.split(",");
 			//fString = trim(fString);
 			var str3 = "";
 			for(var m = 0; m < fString.length; m++) { 
 				fString[m].replace(/[^a-zA-Z 0-9]+/g,'');
 				str3 += String.fromCharCode(fString[m]);
 			}
 			inHindi[k] = str3;
 			getSTR += inHindi[k] + " ";
 		}
 		
 	}
 	return getSTR;
}
function liveTv() {
	try {
		hideAdsDivs();
	} catch(x) {
		
	}
	try {
		hideScroll();
	
		var locale = getCookie("locale");
		var controls, live;
		if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
			live = toScript(records.key250);
			controls = toScript(records.key251);
		} else {
			live = records.key250;
			controls = records.key251;
		}
		setColor();
		var username = getCookie("username");
		var clId = getCookie("clId");
		if(!username && clId) {
			document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key1665 +'</div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ live +' </b></td></tr></table></span></td></tr><tr><td class="tvPanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" align="left" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-right:10px;padding-top:15px;font-size:11px;"><b>'+ controls +'</b></td></tr></table></span><img src="./view/online/images/content/live-tv.png" alt=""/></td></tr></table>';
		} else if(!username && !clId) {
			window.location = "/";
		} else {
			loadPage("fullGuide");
		}
	} catch (x) {
//		alert("errror 10 = " + x);
	}
	return false;
}

function onDemand() {
	try {
		hideAdsDivs();
		
	} catch (x) {
//		alert("error 11 =" + x);
	}
	hideScroll();
	var locale = getCookie("locale");
	var demand, dDesc;
	if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
		demand = toScript(records.key108);
		dDesc = toScript(records.key249);
	} else {
		demand = records.key108;
		dDesc = records.key249;
	}
	setColor();
	var username =  getCookie('username');
	var customerId =  getCookie('customerId');
	var clId = getCookie("clId");
	if(!username && clId) {
		document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key108 +'</div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ demand +' </b></td></tr></table></span></td></tr><tr><td class="onDemandPanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-right:10px;padding-top:15px;font-size:11px;"><b>'+ dDesc +'</b></td></tr></table></span><img src="./view/online/images/content/video.png" alt=""/></td></tr></table>';
	} else if(!username && !clId) {
		window.location = "/";
	} else {
		getOdData(customerId, 0);//loadPage("onDemandPanel");
	}
	return false;
}
function mobile() {
	try {
		hideAdsDivs();
	} catch (x) {
	}
	hideScroll();
	var locale = getCookie("locale");
	var mobile, widget, call;
	if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
		mobile = toScript(records.key246);
		widget = toScript(records.key247);
		call = toScript(records.key248);
	} else {
		mobile = records.key246;
		widget = records.key247;
		call = records.key248;
	}
	setColor();
	document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key1667 +' </div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ mobile +' </b></td></tr></table></span></td></tr><tr><td class="mobilePanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-right:15px;padding-top:15px;font-size:11px;"><b>'+ widget +'</b></td></tr></table></span><span id="hDetails" style="background:url(./view/online/images/panel/pop_left1.png) repeat;text-align:left;"><table><tr><td style="padding-left:35px;padding-right:10px;padding-top:10px;font-size:11px;"><b>'+ call +'</b></td></tr></table></span><img src="./view/online/images/content/mobile.png" alt=""/></td></tr></table>';
}
function photo() {
	try {
		hideAdsDivs();
	} catch (x) {
		
	}
	hideScroll();
	var locale = getCookie("locale");
//	var locale = getCookie("locale");
	var photos, group;
	if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
		photos = toScript(records.key71);
		group = toScript(records.key245);
	} else {
		photos = records.key71;
		group = records.key245;
	}
	setColor();
	var customerId = getCookie('customerId');
	var clId = getCookie("clId");
	if(!customerId && clId) {
		document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key1555 +'</div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ photos +' </b></td></tr></table></span></td></tr><tr><td class="photoPanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-right:10px;padding-top:15px;font-size:11px;"><b>'+ records.key883 +'</b></td></tr></table></span><img src="./view/online/images/content/photoStudio.png" alt=""/></td></tr></table>';		
	} else if(!customerId && !clId) {
		window.location = "/";
	} else {
		loginActive = true;
		var params = "customerId=" + parseInt(customerId);
		loadJspContent("photos", params);
	}
}

var odTypeStatus = -1;
function video() {
	try {
		hideAdsDivs();
		
	} catch (x) {
		
	}
	hideScroll();
	var locale = getCookie("locale");
	var videos, obeeka;
	if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
		videos = toScript(records.key243);
		obeeka = records.key1484;
	} else {
		videos = records.key243;
		obeeka = records.key1484;
	}
	setColor();
	if (document.getElementById("content")) {
		var username =  getCookie('username');
		var customerId =  getCookie('customerId');
		var clId = getCookie("clId");
		if((!username || !customerId) && clId) {
			document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key1590 + '</div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ videos + ' </b></td></tr></table></span></td></tr><tr><td class="videoPanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-right:10px;padding-top:15px;font-size:11px;"><b>'+ obeeka +'</b></td></tr></table></span><img src="./view/online/images/content/obeeka.png" alt=""/></td></tr></table>';
		} else if((!username || !customerId) && !clId) {
			window.location = "/";
		} else {
			odTypeStatus = 1;
			loginActive = true;
			var params = "customerId=" + parseInt(customerId);
			loadJspContent("videoPanel", params);
		} 
	}
}
function audioMessage(widget) {
	try {
		hideAdsDivs();
	} catch (x) {
		
	}
	hideScroll();
	var locale = getCookie("locale");
	var jukebox, control, albums;
	if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
		jukebox = toScript(records.key74);
		control = toScript(records.key252);
		albums = toScript(records.key253);
	} else {
		jukebox = records.key74;
		control = records.key252;
		albums = records.key253;
	}
	setColor();
	var liveWidget = getCookie("liveWidget");
	var username = getCookie("username");
	var customerId = getCookie("customerId");
	var clId = getCookie("clId");
//	alert("in login phase" + username + "username: " + customerId + ", liveWidget" + liveWidget + "_uacct: " + _uacct + "abetu" + clId);
	if((!username || !customerId) && clId) {
//		document.getElementById("login").innerHTML = '';
		document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key1668 +'</div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;margin-top:20px;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ jukebox +' </b></td></tr></table></span></td></tr><tr><td class="audioPanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:25px;padding-right:10px;padding-top:15px;font-size:11px;"><b>'+ albums +'</b></td></tr></table></span><span id="hDetails" style="background:url(./view/online/images/panel/pop_left1.png) repeat;text-align:left;"><table><tr><td style="padding-left:35px;padding-right:10px;padding-top:10px;font-size:11px;"><b>'+ control +'</b></td></tr></table></span><img src="./view/online/images/content/jukebox.png" alt=""/></td></tr></table>';	
//		loadJspContent("audio");
	} else if((!username || !customerId) && !clId) {
		window.location = "/";
	} else {
		loginActive = true;
		var params = "customerId=" + parseInt(customerId);
		loadJspContent("audioPanel", params);
	}
	return false;
}

function games() {
	try {
		hideAdsDivs();
		
	} catch (x) {
		
	}
	hideScroll();
	var locale = getCookie("locale");
	var games, gDesc;
	if (locale == "hi" || locale == "zh" || locale == "ar" || locale == "bg" || locale == "gr" || locale == "ja" || locale == "ru" || locale == "th" || locale == "uk") {
		games = toScript(records.key73);
		gDesc = toScript(records.key242);
	} else {
		games = records.key73;
		gDesc = records.key242;
	}
	setColor();
	document.getElementById("content").innerHTML = '<table style="width:800px;"><tr><td class="baloonTitle" style="text-align:left;font-family:Trebuchet MS;padding-top:5px;"><div style="text-align:left;padding-left:112px;font-size:24px;">' + records.key1483 + ':&nbsp;'+ records.key73 +'</div><span id="popUp4" style="background:url(./view/online/images/panel/popup4.png) repeat;text-align:left;"><table><tr><td style="padding-left:80px;padding-right:5px;padding-top:25px;font-size:15px;font-family:Trebuchet MS;font-weight:bold;"><b> '+ games +' </b></td></tr></table></span></td></tr><tr><td class="gamePanel" valign="middle" style="height:520px;text-align:center;font-family:Trebuchet MS;"><span id="cPanel" style="background:url(./view/online/images/panel/pop_down1.png) repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-right:10px;padding-top:15px;font-size:11px;"><b>'+ gDesc +'</b></td></tr></table></span><img src="./view/online/images/content/game.png" alt=""/></td></tr></table>';
}

function moreWidget() {
	login();
}

function hideScroll() {
	if (loginTimer) {
		window.clearInterval(loginTimer);
		loginTimer = 0;
	}
	broadcastFlag = 0;
	broadcastConfFlag = 0;
	if (loginConfTimer) {
		window.clearInterval(loginConfTimer);
		loginConfTimer = 0;
	}
	var pos = YAHOO.util.Dom.getXY('content');
	scrollToTop();
	document.getElementById("smoothScroll").style.display = "none";
	Dom.setStyle('content', 'overflow', 'auto');
	var objDiv = YAHOO.util.Dom.get('content').scrollHeight;
	var _app = navigator.appName;
}

function scrollToTop() {
	var attributes = {
	      scroll: { to: [0, -100] }
	};
	var anim = new YAHOO.util.Scroll('content', attributes);
	anim.animate();
}
var toggleSearch = true;
var textStatus = false;
var searchIndex = true;

function widgetSearchStart() {
	surveyActive = false;
	videoActive = false; // to activate the search after video navigation.
	vodActive = false; // to activate the search after vod navigation.
	horoscopeActive = false;
	calcActive = false;
	newsActive = false;
	blogActive = false;
	GeneralNewsActive = false;
	loginActive = false;
	staffComActive = false;
	mealActive = false;
	painAlertActive = false;
	spiritualActive = false;
	assignedActive = false;
	gameActive = false;
	calendarActive = false;
	menuActive = false;
	blogActive = false;
	if (toggleSearch == true || textStatus == true) {
		toggleSearch = false;
		widgetSearch();
	} else {
		toggleSearch = true;
		if(bInterval != null) {
			window.clearInterval(bInterval);
			bInterval = null;
			textStatus = false;
			searchContent1();
		}
	}
}

function widgetSearch() {
	var status = false;
	var text = document.getElementById("searchTitle").innerHTML;
	if(textStatus) {
		if(text != null) {
			var customerId = getCookie("customerId");
			var params = "customerId=" + customerId + "&search=" + "";
			if(!customerId) {
				if(text == "mobile" || text == "MOBILE") {
					mobile();
				} else if(text == "live tv" || text == "LIVE TV") {
					liveTv();
				} else if(text == "on-demand" || text == "ON-DEMAND") {
					onDemand();
				} else if(text == "photos" || text == "PHOTOS" || text == "PHOTO" || text == "photo") {
					photo();
				} else if(text == "VIDEO" || text == "video") {
					video();
				} else if(text == "alert" || text == "ALERT") {
					alertMessage();
				} else if(text == "games" || text == "GAMES") {
					games();
				} else if(text == "audio" || text == "AUDIO") {
					audioMessage();
				} else {
					noResult();
					document.getElementById("sCriteria").innerHTML =  records.key1485 + ":" + document.getElementById("searchTitle").innerHTML;
				}	
			} else {
				loadJspContent("sideWidgets", params);
			}
			
			document.getElementById("blinkPanel").innerHTML = "";
			if(blinkCursor != null) {
				window.clearInterval(blinkCursor);
				blinkCursor = null;
			}
			textStatus = false;
			searchContent1();
		}
		toggleSearch = true; 
	} else {
		document.getElementById("searchTitle").innerHTML = "";
		Dom.setStyle('searchTitle', 'padding-left', 10 + 'px');
		putCursor();
	}
	return false;	
}
function noResult() {
	hideScroll();
	document.getElementById("content").innerHTML = '<div id="sCriteria" style="text-align:left;font-size:24px;padding-left:112px;padding-top:5px;"></div><div id="noResult" style="text-align:left;font-size:20px;padding-left:112px;padding-top:20px;">' + records.key409 + '!</div>';
	return false;
}
function mainFocus() {
	surveyActive = false;
	horoscopeActive = false;
	calcActive = false;
	newsActive = false;
	GeneralNewsActive = false;
	gameActive = false;
	return false;	
}
/*
function keyAction(e) {
	if(e.keyCode) 
		keyCodeNum = e.keyCode;
	else 
		keyCodeNum = e.which;	
	keyHandler(keyCodeNum);
}
function keyHandler(keyCodeNum) {
	return;
}
*/
function clearLogin1(form) {
	form.username.value="";
	form.password.value="";
	document.getElementById("loginInvalid").innerHTML = "";
	if(form.rememberMe.checked == true) {
		form.rememberMe.checked = false;
	}
}

function passwordAssistancePanel() {
	try {
	document.getElementById('content').innerHTML = '<table style="width:800px;"> <tr><td style="text-align:right;padding-right:10px;padding-top:10px;font-size:15px;font-family:Trebuchet MS;"><a onClick="login();" id="login" style="cursor:pointer;color:green;"> ' + records.key3 + ' </a> &nbsp;|&nbsp; <a onClick="signUp();" id="signUp" style="cursor:pointer;color:green;"> ' + records.key5 + '! </a></td></tr></table>' 
												+ '<br/><br/>'
												+ '<p style="font:Trebuchet MS;font-size:30px;padding-left:50px;"><b>' + records.key45 + '</b></p>'
												+ '<br/>'
												+ '<p style="font:Trebuchet MS;font-size:15px;padding-left:50px;">' + records.key54 + '</p>';
	 } catch(x) {												
//		alert(4 + " * " + x);
	}
}

function confirmationPanel(userName) {
	document.getElementById('content').innerHTML = '<table style="width:800px;"> <tr><td style="text-align:center;padding-top:10px;font-size:30px;font-family:Trebuchet MS;"><b>'+ records.key1465 +'</b></td></tr></table>' 
												+ '<br/><br/>'
												+ '<p style="font:Trebuchet MS;font-size:15px;padding-left:50px;text-align:justify;"> '+ records.key1466 + userName +'</p>'
												+ '<br/>'
												+ '<p style="font:Trebuchet MS;font-size:15px;padding-left:50px;text-align:justify;">'+ records.key1467 +'</p>';
}
function forgotPassword() {
	hideScroll();
	try {
	var _app = navigator.appName;
	if (_app == 'Netscape') {
		var row = '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="padding-left:180px;padding-top:20px;"><b><em><p> ' + records.key29 + '</p><p>' + records.key30 + '</p></td></tr>'
				+ '<tr><td align="left" style="padding-left:180px;padding-top:10px;"><p><input type="text" id="username" name="username" style="width:300px;height:20px;" tabIndex=1/> <input type="submit" class="forgotButton" value="'+ records.key27 +'" tabIndex=2/> </p></td></tr>';
	} else {
		var row = '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:left;padding-left:180px;padding-top:20px;"><b><em><p> ' + records.key29 + '</p><p>' + records.key30 + '</p><br/></td></tr>'
				 + '<tr><td align="left" style="padding-left:180px;"><p><input type="text" id="username" name="username" style="width:300px;height:20px;" tabIndex=1 onFocus="searchContent1();" /> <input type="submit" class="forgotButton" value="'+ records.key27 +'" tabIndex=2/> </p></td></tr>';			
	}
	setColor();
	document.getElementById('forPass').style.color = '#718dcb';
	document.getElementById("content").innerHTML = '<form id="form" name="form"  onsubmit="return resetPassword(this);">' 
												+ '<table style="width:800px;font-family:Trebuchet MS;"> <tr><td style="text-align:right;padding-right:10px;padding-top:7px;font-size:15px;font-family:Trebuchet MS;"><a onClick="login();" id="login" style="cursor:pointer;color:green;"> ' + records.key3 + ' </a> &nbsp;|&nbsp; <a onClick="signUp();" id="signUp" style="cursor:pointer;color:green;"> ' + records.key5 + ' </a></td></tr>'
												+ '<tr> <td style="text-align:left;padding-top:130px;padding-left:180px;font:Trebuchet MS;font-size:36px"> <b><em> ' + records.key4 + '? </em></b></td></tr>' 
												+ row
												+ '</table>'
												+'<div id="forgotPassword" style="font-size:15px;color:red;text-align:left;"></div>'
												+ '</form>';
	} catch(x) {												
//		alert(1 + " * " + x);
	}
	userFocus();
}

function userFocus() {
	if(document.getElementById('username'))
		window.setTimeout("document.getElementById('username').focus()", 500);
}

function signUp() {
	var uagent = navigator.userAgent.toLowerCase();
	var signHTML = "";
	if(uagent.indexOf("msie") >=0 ) {
		signHTML = '<div align="left" class="popUpTitle" style="text-align:left;font-family:comic Sans MS;"><span align="left" id="whySign" style="background:url(./view/analytics/images/content/betaUsers.png) no-repeat;text-align:left;margin-left:-370px;margin-right:30px;margin-top:40px;"><table><tr><td align="center" style="padding-top:50px;font-size:36px;font-family:trebuchet MS;"><b> ' + records.key90 + '!</b></td></tr><tr><td align="center" style="font-size:36px;font-family:trebuchet MS;"><b>' + records.key1697 + '</b></td></tr><tr><td align="center" style="padding-top:70px;width:700px;"><img src="./view/sms/images/content/smily.png" /></td></tr></table></span></div>'
	} else {
		signHTML =  '<div align="left" class="popUpTitle" style="text-align:left;font-family:comic Sans MS;"><span align="left" id="whySign" style="background:url(./view/analytics/images/content/betaUsers.png) no-repeat;text-align:left;margin-left:30px;margin-right:30px;margin-top:40px;"><table><tr><td align="center" style="padding-top:50px;font-size:36px;font-family:trebuchet MS;"><b> ' + records.key90 + '!</b></td></tr><tr><td align="center" style="font-size:36px;font-family:trebuchet MS;"><b>' + records.key1697 + '</b></td></tr><tr><td align="center" style="padding-top:70px;width:700px;"><img src="./view/sms/images/content/smily.png" /></td></tr></table></span></div>'
	}
	hideScroll();
	document.getElementById('terms').style.color = '#373737';
	document.getElementById('privacy').style.color = '#373737';
	document.getElementById('jobsA').style.color = '#373737';	
	document.getElementById('forLog').style.color = '#ffffff';
	document.getElementById("signUp").style.color = '#718dcd';
	document.getElementById("content").innerHTML = '<form id="loginForm" name="loginForm" onSubmit="return validateLoginForm(this);">'
												+ signHTML
//												+ '<div align="left" class="popUpTitle" style="text-align:left;font-family:comic Sans MS;"><span align="left" id="whySign" style="background:url(./view/online/images/content/betaUsers.png) no-repeat;text-align:left;"><table align="left"><tr><td align="center" style="padding-top:50px;font-size:36px;font-family:trebuchet MS;"><b>' + records.key90 + '</b></td></tr><tr><td align="center" style="font-size:36px;font-family:trebuchet MS;"><b>' + records.key1697 + '</b></td></tr><tr><td align="center" style="padding-top:70px;width:700px;"><img src="./view/online/images/content/smily.png" /></td></tr></table></span></div>'
												+ '<table style="width:800px;"> <tr><td style="text-align:right;padding-right:10px;padding-top:7px;font-size:15px;font-family:Trebuchet MS;"><a class="whySignUpPanel" style="cursor:pointer;color:green;" onClick="blur();whySignUpPanel();"> ' + records.key46 + '? <span style="background:url(./view/online/images/content/popUp.png) no-repeat;text-align:left;"><table><tr><td style="padding-left:45px;padding-top:6px;"><b>' + records.key46 + '?</b></td></tr><tr><td style="padding-left:45px;padding-right:25px;padding-top:8px;font-size:13px;text-align: justify;"><b><em>' + records.key51 + '</b></em></td></tr></table></span></a> &nbsp;|&nbsp; <a class="loginPanel" onClick="login();" id="login" style="cursor:pointer;color:green;"> ' + records.key3 + ' <span style="background:url(./view/online/images/content/popUpRight.gif) no-repeat;text-align:left;"><table><tr><td style="padding-left:15px;padding-top:6px;"><b>login</b></td></tr><tr><td style="padding-left:15px;padding-top:8px;font-size:13px;text-align:justify;padding-right:70px;"><b><em>' + records.key1468 + '</em></b></td></tr></table></span></a>&nbsp;|&nbsp;<a onClick="forgotPassword();" id="forPass" style="cursor:pointer;color:green;"> ' + records.key4 + '? </a></td></tr>'  
												+ '<tr> <td style="text-align:left;padding-top:10px;padding-left:50px;font:Trebuchet MS;font-size:24px"><b><em>' + records.key16 + '<em></b></td></tr>'
												+ '<tr> <td style="text-align:left;padding-top:10px;padding-left:50px;font:Trebuchet MS;font-size:15px"><b><em>' + records.key17 + '<br/>'  + records.key18 + '<em></b></td></tr>'  
												+ '<tr> <td style="font:Trebuchet MS;font-size:15px;height:15px;padding-top:10px;"><b><em>' 
													+ '<table style="padding-left:50px;" >' 
													+ '<tr><td width="50%" style="padding-top:2px;text-align:right;"> ' + records.key19 + ':</td><td style="padding-left:10px;padding-top:2px;text-align:left;" ><input type="text" id="username" name="username" style="width:230px;height:20px;" tabIndex="1" onFocus="searchContent1();"/> <input type="button" value="' + records.key28 + '" class="checkButton" onClick="userValidation(this.form);" tabIndex="2"/> <span id="loader" width="15px"></span></td> </tr>'
													+ '<tr><td></td><td style="padding-left:10px;"><div width="50px" id="checkUsername" style="text-align:left;font-size:12px;color:red;"></div></td></tr>'
													+ '<tr><td style="text-align:right;padding-top:2px;">' + records.key12 + ':</td> <td style="padding-left:10px;padding-top:2px;text-align:left;"> <input type="password" id="password" name="password" style="width:230px;height:20px;" tabIndex=3 onFocus="searchContent1();"/></td></tr>'
													+ '<tr><td style="text-align:right;padding-top:2px;"> ' + records.key20 + ': </td><td style="padding-left:10px;padding-top:2px;text-align:left;"> <input type="password" id="repassword" name="repassword" style="width:230px;height:20px;" tabIndex=4 onFocus="searchContent1();"/> </td></tr>'
													+ '<tr><td style="text-align:right;padding-top:2px;"> ' + records.key21 + ': </td><td style="padding-left:10px;padding-top:2px;text-align:left;"> <input type="text" id="email" name="email" style="width:230px;height:20px;" tabIndex=5 onFocus="searchContent1();" /> </td></tr>'
													+ '<tr><td style="text-align:right;padding-top:2px;"> ' + records.key22 + ': </td><td style="padding-left:10px;padding-top:2px;text-align:left;"> <input type="text" id="firstName" name="firstName" style="width:230px;height:20px;" tabIndex=6 onFocus="searchContent1();"/> </td></tr>'
													+ '<tr><td style="text-align:right;padding-top:2px;"> ' + records.key23 + ': </td><td style="padding-left:10px;padding-top:2px;text-align:left;"> <input type="text" id="lastName" name="lastName" style="width:230px;height:20px;" tabIndex=7 onFocus="searchContent1();"/> </td></tr>'
													+ '<tr><td style="text-align:right;padding-top:2px;"> ' + records.key24 + ': </td><td style="padding-left:10px;padding-top:2px;text-align:left;"> <input type="text" id="zip" name="zip" style="width:230px;height:20px;" tabIndex=8 onFocus="searchContent1();"/> </td></tr>'
													+ '</table>'
												+ '</em></b></td></tr>'
												+ '<tr><td style="text-align:left;font-size:15px;padding-top:10px;padding-left:40px;"><input type="checkbox" id="option1" name="option1" value="checked" tabIndex=9/> &nbsp; ' + records.key25 + '</td></tr>'
												+ '<tr><td style="text-align:left;font-size:15px;padding-top:10px;padding-left:40px;"><input type="checkbox" id="option2" name="option2" vaule="checked" tabIndex=10/> &nbsp; ' + records.key26 + '</td></tr>'
												+ '<tr><td align="center" style="text-align:center; font-size:15px;padding-top:10px;"><input type="submit" value="' + records.key27 + '" class="forgotButton" onClick="return validateLoginForm(form);" tabIndex=11/></td></tr>'
												+ '</table>'
												+ '</form>';
}

function validateLoginForm(form) {
	var locale = getCookie("locale");
	var user = "";
	var pass = "";
	var usernameValidationAlert = "";
	var passwordRangeAlert = "";
	var confirmPasswordAlert = "";
	var confirmPasswordNotMatchedAlert = "";
	var emailValidationAlert = "";
	var emailAlert = "";
	var firstNameAlert = "";
	var lastNameAlert = "";
	var zipAlert = "";
	var agreeTermsAlert = "";
	var userNotAvailable = "";
	
	if (locale == "zh" || locale == "hi") {
		user = toScript(records.key460);
		pass = toScript(records.key15);
		usernameValidationAlert = toScript(records.key31);
		passwordRangeAlert = toScript(records.key1613);
		confirmPasswordAlert = toScript(records.key1614);
		confirmPasswordNotMatchedAlert = toScript(records.key1615);
		emailValidationAlert = toScript(records.key35);
		emailAlert = toScript(records.key36);
		firstNameAlert = toScript(records.key37);
		lastNameAlert = toScript(records.key38);
		zipAlert = toScript(records.key39);
		agreeTermsAlert = toScript(records.key40);
		userNotAvailable = toScript(records.key1616);
	} else {
		user = records.key460;
		pass = records.key15;
		usernameValidationAlert = records.key31;
		passwordRangeAlert = records.key1613;
		confirmPasswordAlert = records.key1614;
		confirmPasswordNotMatchedAlert = records.key1615;
		emailValidationAlert = records.key35;
		emailAlert = records.key36;
		firstNameAlert = records.key37;
		lastNameAlert = records.key38;
		zipAlert = records.key39;
		agreeTermsAlert = records.key40;
		userNotAvailable = records.key1616;
	}
	if(form.username.value == "") {
		Alert.fnAlert(user, null, form.username);
		return false;
	} else {
		var check = emailValidation(form.username);
		if ( check == 0) {
			Alert.fnAlert(usernameValidationAlert, null, form.username);
			return false;
		}
	} 
	if(form.password.value == "") {
		Alert.fnAlert(pass, null, form.password);	
		return false;
	}
	if(form.password.value.length < 6 || form.password.value.length > 10) {
		Alert.fnAlert(passwordRangeAlert, null, form.password);	
		return false;
	}
	if(form.repassword.value == "") {
		Alert.fnAlert(confirmPasswordAlert, null, form.repassword);
		return false;
	}
	if(form.password.value != form.repassword.value) {
		Alert.fnAlert(confirmPasswordNotMatchedAlert, null, form.repassword);
		return false;
	}
	if(form.email.value == "") {
		Alert.fnAlert(emailAlert, null, form.email);
		return false;
	} else {
		var check = emailValidation(form.email);
		if ( check == 0) {
			Alert.fnAlert(emailValidationAlert, null, form.email);
			return false;
		}
	}
	if(form.firstName.value == "") {
		Alert.fnAlert(firstNameAlert, null, form.firstName);
		return false;
	}
	if(form.lastName.value == "") {
		Alert.fnAlert(lastNameAlert, null, form.lastName);
		return false;
	}
	if(form.zip.value == "") {
		Alert.fnAlert(zipAlert, null, form.zip);
		return false;
	}
	if(form.option1.checked == false) {
		Alert.fnAlert(agreeTermsAlert, null, form.option1);
		return false;
	}
	loaderPanel1();
	
	var params='method=saveUser&username=' + form.username.value 
		+ '&password=' + hex_sha1(hex_md5(form.password.value)) 
		+ '&email='+ form.email.value
		+ '&firstName='+ form.firstName.value
		+ '&lastName='+ form.lastName.value
		+ '&zip='+ form.zip.value;
	var serverUrl="/OnlineAdmin";
	createRequest();
	if(ajaxRequest == null) {
		document.getElementById("content").innerHTML = "Loading...";
		return false;
	}
	ajaxRequest.onreadystatechange=function() {
		if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			response = ajaxRequest.responseText;
			loaderPanel.hide();
			document.getElementById("checkUsername").style.paddingTop = "10px";
			if(response == 1) {
				document.getElementById("checkUsername").innerHTML = '<P style="font-family:Trebuchet MS, calibri, verdana;">' + userNotAvailable + '</P>' ;
			} else if(response == 2) {
				document.getElementById("checkUsername").innerHTML = '<P style="font-family:Trebuchet MS, calibri, verdana;">' + usernameValidationAlert + '</P>';
			} else if(response == 3) {
				document.getElementById("checkUsername").innerHTML = '<P style="font-family:Trebuchet MS, calibri, verdana;">' + records.key1617 + '</P>';
			} else if(response == 4) {
				document.getElementById("checkUsername").innerHTML = '<P style="font-family:Trebuchet MS, calibri, verdana;">' + records.key1618 + '</P>';
			} else {
				confirmationPanel(form.username.value);
			}
		}
	};
	ajaxRequest.open("POST", serverUrl, true);
	ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajaxRequest.send(params);
	return false;
}

function whoisAkeebo() {
	setColor();
	try {
		hideAdsDivs();
	} catch(x) {
		
	}
	hideScroll();
	document.getElementById("content").innerHTML = '<table style="font:Trebuchet MS;width:800px;font-size:15px;"> <tr> <td style="text-align:justify;padding-top:10px;padding-left:20px;padding-right:20px;width:800px;"> <br/>' 
												+ '<p>' + ((records != null && records.key231 != undefined) ? records.key231 : "we are a pack of internet enthusiasts with a mission to facilitate easier development and integration of web applications (widgets)" ) + "&nbsp;" + ((records != null && records.key1440!= undefined) ? records.key1440: "on the top of our home grown akeebo platform. also, since a device comes alive with content, we intend to position ourselves " ) +  ((records != null && records.key1441!= undefined) ? records.key1441: "as a leading force in content aggregation and distribution business via cool widgets." ) + '</p><br/>'
												+ '<p>' + ((records != null && records.key171 != undefined) ? records.key171 : "We believe that akeebo's development paradigm is the future. Consumers will progress toward primarily consuming " ) + ((records != null && records.key1333 != undefined) ? records.key1333 : "web content (media or applications) in the form of widgets. We are facilitating this by allowing people to express, connect, " ) + "&nbsp;" +((records != null && records.key1334 != undefined) ? records.key1334 : "create, and inform using widgets built on akeebo platform. We want to be the world's leading distributed " ) + "&nbsp;" + ((records != null && records.key1335 != undefined) ? records.key1335 : "  marketplace for web widgets with billions of monthly viewers and thousands of developers and internet enthusiasts creating " ) + ((records != null && records.key1336 != undefined) ? records.key1336 : " widgets in diverse categories such as movies, music, games, and art " ) +'. </p><br/>'
												+ '<p>' + ((records != null && records.key172 != undefined) ? records.key172 : "Please contact us at our offices for platform licensing, custom build or integration services. Our offices can help you with" ) + ((records != null && records.key1337 != undefined) ? records.key1337 : " any request, including scheduling a personal demonstration of our capabilities or supporting our existing implementations " ) + '. </p> <br/>'
												+ '<p> ' + ((records != null && records.key2069 != undefined) ? records.key2069 : "You can write to us at" ) + ': </p>'
												+ '<p style="padding-left:20px;">Akeebo Corporation</p>'
												+ '<p style="padding-left:20px;">9191 R.G. Skinner Pkwy Suite 401 </p>'
												+ '<p style="padding-left:20px;">Jacksonville Florida 32256-9659 USA</p>'
												+ '<p style="padding-left:20px;"> corporate@akeebo.com </p>'
												+ '</td></tr></table>';
	return false;
}

function principle() {
	document.getElementById('terms').style.color = '#373737';
	document.getElementById('privacy').style.color = '#373737';
	document.getElementById('jobsA').style.color = '#373737';	
	document.getElementById("content").innerHTML = '<table style="width:100%;font-size:15px;">'
												+ '<tr><td style="text-align:center;font-family:Trebuchet MS;font-size:48px;padding-top:10px;">' + ((records != null && records.key1788!= undefined) ? records.key1788 :"Business Principles" ) + '</td></tr>'
//												+ '<tr><td style="text-align:justify;padding-top:10px;padding-right:40px;padding-left:40px;">'
//													+ ((records != null && records.key1753!= undefined) ? records.key1753 :"When a company such as ours puts its ideas to work, and when we create jobs, those jobs are the best" ) + '&nbsp;' + ((records != null && records.key1754!= undefined) ? records.key1754 :"housing, education, health and retirement programs ever created. Our business is highly competitive, and" ) + '&nbsp;' + ((records != null && records.key1755!= undefined) ? records.key1755 :"we aggressively seek to expand our client relationships" ) + '.' 
//												+ '</td></tr>'
												+ '<tr><td style="text-align:justify;padding-top:10px;padding-right:40px;padding-left:40px;">'
													+ '1. ' + ((records != null && records.key1756!= undefined) ? records.key1756 :"Akeebo Corporation is founded with an aspiration to provide a robust and IP-enabled devices in the" ) + '&nbsp;' + ((records != null && records.key1757!= undefined) ? records.key1757 :"form of a well structured software comprehensive framework stack; and to encourage a global community" ) + '&nbsp;' + ((records != null && records.key1758!= undefined) ? records.key1758 :"of software collaborators, entrepreneurs, visionaries, and enthusiasts toward creating practical online" ) + '&nbsp;' + ((records != null && records.key1759!= undefined) ? records.key1759 :"applications of the future atop the akeebo platform using its open and simple programming interface" ) + '.'
												+ '</td></tr>'
												+ '<tr><td style="text-align:justify;padding-top:10px;padding-right:40px;padding-left:40px;">'
													+ '2. ' + ((records != null && records.key1760!= undefined) ? records.key1760 :"As a firm, our clients interests always come first. Our experience shows that if we serve our clients " ) + '&nbsp;' + ((records != null && records.key1761!= undefined) ? records.key1761 :"well, our own success will follow. As a result, we stress creativity and imagination in everything we do" ) + '.'	
												+ '</td></tr>'
												+ '<tr><td style="text-align:justify;padding-top:10px;padding-right:40px;padding-left:40px;">'
													+ '3. ' + ((records != null && records.key1762!= undefined) ? records.key1762 :"We constantly strive to find a better solution to a client's unique problems. The dedication of our people" ) + '&nbsp;' + ((records != null && records.key1763!= undefined) ? records.key1763 :"to the firm and the intense effort they give their jobs are greater than one finds in most other organizations" ) + '.'
												+ '</td></tr>'
												+ '<tr><td style="text-align:justify;padding-top:10px;padding-right:40px;padding-left:40px;">'
													+ '4. ' + ((records != null && records.key1764!= undefined) ? records.key1764 :"We are big enough to undertake the largest project that any of our clients could contemplate, yet small" ) + '&nbsp;' + ((records != null && records.key1765!= undefined) ? records.key1765 :"enough to maintain the loyalty, intimacy and the esprit de corps that we all treasure" ) + '.'	
												+ '</td></tr>'
												+ '<tr><td style="text-align:justify;padding-top:10px;padding-right:40px;padding-left:40px;">'
													+ '5. '+ ((records != null && records.key1766!= undefined) ? records.key1766 :"We consider our size an asset that we try hard to preserve. The dedication of our people to the firm" ) + '&nbsp;' + ((records != null && records.key1767!= undefined) ? records.key1767 :"and the intense effort they give their jobs are greater than one finds in most other organizations" ) + '.'
												+ '</td></tr>'
												+ '</table>';
	return false;
}
function termsOfUseClick() {
try {	
	document.getElementById('content').innerHTML = '<div id="mycustomscroll" class="flexcroll" ><table id="termsOfUse" onclick="blur()"style="width:750px;"><tr> <td style="text-align:center;padding-top:10px;font:Trebuchet MS;font-size:48px;width:800px;"> <b><em> ' + records.key1932 + ' <em></b></td></tr> '
		 + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p><b>'+ records.key273 +'</b></p><br/>' 
	     + '<p>' + records.key274 + records.key1933 + records.key1934 + 'Copyright (c) Akeebo Corporation. All rights reserved.</p><br/>' 
	     + '<p><b>' + records.key275 + '</b></p><br/>' 
	     + '<p> ' + records.key276 + records.key1935 + records.key1936 + ' </p><br/>'
	     + '<p><b> ' + records.key277 + '</b></p><br/>'
	     + '<p>' + records.key1937 + records.key1938 + records.key1939 + '</p><br/>'
	     + ' </td></tr> ' 
	     + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><b>' + records.key279 + '</b><br/><br/>'
	     + '<p>' + records.key280 + records.key1940 + records.key1941 + '</p><br/>'
	     + '<p><b>' + records.key281 + '</b></p><br/>'
	     + '<p>' + records.key282 + ' </p><br/>'
	     + '<p><b>' + records.key283 + '</b></p><br/>'
	     + '<p>' + records.key284 + records.key1942 + records.key1943 + records.key1944 +  records.key286 + records.key1945 + records.key1946 + '</p>'
	     //+ '<p>' + records.key285 + '.</p><br/>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p>' + records.key1947 + records.key1948 + records.key1949 + records.key1950 + records.key1951 + records.key1952 + records.key1953 + '</p><br/>'
	     + '<p><b>' + records.key287 + '</b></p>'
	     + '<p>' + records.key288 +"&nbsp;"+ records.key1954 + records.key1955 + records.key1956 + '</p><br/>'
	     + '<p>' + records.key466 + records.key1957 +"&nbsp;"+ records.key1958 + records.key1959 + records.key1960 + '</p><br/>'	
	     + '<p>' + records.key290 + records.key1961 +"&nbsp;"+ records.key1962 + records.key1963 + records.key1964 + records.key1965 + records.key1966 + records.key1967 + '</p>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p>' + records.key291 + records.key1968 + records.key1969 + ' </p><br/>' 
	//     + '<p>' + records.key467 + '.</p><br/>'
	     + '<p><b>' + records.key292 + '</b></p><br/>'
	     + '<p>' + records.key293 + records.key1970 + records.key1971 + records.key1972 + '</p><br/>'
	     + '<p><b>' + records.key294 + '</b></p>' 
	     //+ '<p> ' + records.key295 + '.</p><br/>'
	     + '</td></tr> ' 
	     + ' <tbody><tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p>'+ records.key468 + records.key1973 + records.key1974 + records.key1975 + records.key1976 + records.key1977 + '</p><br/>' 
	     + '<p><b>' + records.key296 + '</b></p><br/>'
	     + '<p>' + records.key297 + records.key1978 + records.key1979 + records.key1980 + records.key1981 + records.key1982 + ' </p>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/> <p><b>' + records.key298 + '</b></p><br/>'
	     + '<p>' + records.key299 + records.key1983 + records.key1984 +"&nbsp;"+ records.key1985 + records.key1986 +':</p>' 
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:60px;padding-right:50px;"><br/>'	
	     + '<p> 1. ' + records.key300 + records.key1987 +'</p><br/>'
	     + '<p> 2. ' + records.key301 + '</p>'
	//     + '<p>3. ' + records.key302 + '.</p><br/>'
	     + '</td></tr> ' 
	     
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:60px;padding-right:50px;"><br/>'
	     + '<p>3. ' + records.key302 +'&nbsp;'+ records.key1988 + '</p><br/>'
	     + '<p>4. ' + records.key303 + records.key1989 + records.key1990 + '</p><br/>'
	     + '<p>5. ' + records.key304 + records.key1991 + '</p><br/>'
	     + '<p>6. ' + records.key305 + records.key1992 + '</p>'
	//     + '<p>7. ' + records.key306 + '.</p><br/>'
	//     + '<p>8. ' + records.key307 + '.</p><br/>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:60px;padding-right:50px;"><br/>'
	     + '<p>7. ' + records.key306 + records.key1993 + '</p><br/>'
	     + '<p>8. ' + records.key307 + records.key1994 +'</p><br/>'
	     + '<p>9. ' + records.key308 + records.key1995 +'</p><br/>'
	     + '<p>10. ' + records.key309 + '</p>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:60px;padding-right:50px;"><br/>' 
	//     + '<p>9. ' + records.key308 + '.</p><br/>'
	//     + '<p>10. ' + records.key309 + '.</p><br/>'
	     + '<p>11. ' + records.key310 + '</p><br/>'
	     + '<p>12. ' + records.key311 + '</p><br/>'
	     + '<p>13. ' + records.key312 + '</p><br/>'
	     + '<p>14. ' + records.key313 + '</p><br/>'
	     + '<p>15. ' + records.key314 + records.key1996 + '</p>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/>' 
	     + '<p>' + records.key315 + records.key1997 + records.key1998 + '</p><br/>'
	     + '<p>' + records.key316 +"&nbsp;"+ records.key1999 + records.key2000 + '</p><br/>'
	     + '<p>' + records.key317 + records.key2001 + records.key2002 + records.key2003 + records.key2004 +'</p>'
	     //+ '<p>' + records.key318 + '.</p><br/>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/>'
	     + '<p><b>' + records.key319 + '.</b></p><br/>'
	     + '<p>' + records.key320 + records.key2005 + records.key2006 + records.key2007 + records.key2008 + records.key2009 + records.key2010 + "&nbsp;" + records.key2011 + records.key2012 + records.key2013 + '</p>'
	//     + '<p>' + records.key321 + '.</p><br/>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/>'
	     + '<p>' + records.key321 + records.key2014 +"&nbsp;"+ records.key2015 + '</p><br/>'
	     + '<p>' + records.key322 + records.key2016 + ' </p>' 
	//     + '<p>' + records.key323 + '. </p><br/>'
	     + '</td></tr> ' 
	     + ' <tbody><tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/>'
	     + '<p>' + records.key464 + records.key2017 + records.key2018 +'</p><br/>'
	//     + '<p>The licenses granted in the preceding sentences for a Images will terminate at the time you completely remove such Images from the services, provided that, such termination shall not affect any licenses granted in connection with such Images prior to the time you completely remove such Images. No compensation will be paid with respect to the use of your images.</p><br/>' 
	     + '<p><b>' + records.key324 + '</b></p><br/>'
	     + '<p>' + records.key325 + records.key2019 + records.key2020 + records.key2021 + records.key2022 + records.key2023 +'</p><br/>'
	     + '</td></tr> ' 
	     + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/>'
	//     + '<p><b>COPYRIGHT NOTICE</b></p><br/>'
	     + '<p><b>' + records.key326 + '</b></p><br/>'
	     + '<p>&#169; akeebo corporation. all rights reserved.</p>'
	     + '<p>' + records.key327 + "&nbsp;" + records.key2024 +'</p><br/>'
	     + '</td></tr> ' 
	     + '</table>'
		 + '</div>';
	
	fleXenv.globalInit();
	fleXenv.initialized = false;
	} catch(x) {
//		alert("error 12 = " + x);
	}
}

function privacyClick() {
	document.getElementById('content').innerHTML = '<div id="mycustomscroll" class="flexcroll" ><div class="lipsum"><table id="privacyPolicy" onclick="blur()" width="100%" style=""><tr> <td style="text-align:center;padding-top:10px;font:Trebuchet MS;font-size:48px;width:810px;"> <b><em> ' + records.key1879 + ' <em></b></td></tr> '
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p>' + records.key176 + '</p><br/>' 
		 + '<p><b><u>' + records.key2026 + '</b></u></p><br/>'			
		 + '<p>' + records.key177 + records.key1880 + records.key1881 +'</p><br/>' 
		 + '<p>' + records.key178 + '</p><br/>' 
		 + '<p><b> 1.<u>' + records.key179 + '</b></u></p><br/>'
		 + '<p><b> 2.<u>' + records.key180 + '</b></u></p><br/>'
		 + '<p><b> 3.<u>' + records.key181 + '</b></u></p><br/>'
		 + '<p><b> 4.<u>' + records.key182 + '</b></u></p><br/>'
		 + '</td></tr> ' 
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;">'
		 + '<p><b> 5.<u>' + records.key183 + '</b></u></p><br/>'
		 + '<p><b> 6.<u>' + records.key184 + '</b></u></p><br/>'
		 + '<p><b> 7.<u>' + records.key185 + '</b></u></p><br/>'
		 + '<p><b> 8.<u>' + records.key186 + '</b></u></p>'
		 + '<p></p><br/>'
		 + '<p><b><u>' + records.key187 + '</b></u></p><br/>'
		 + '<p>' 	+ records.key188 + records.key1882 + records.key1883 + records.key1884 + records.key1885 + '</p>'
		 + '</td></tr> ' 
		 + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><p>' + records.key189 + "&nbsp;" + records.key1886 +'&nbsp;'+ records.key190 +'&nbsp;'+ records.key1887 + records.key1888 + records.key1889 + records.key1890 + records.key1891 + records.key1892 + '</p><br/>'
		// + '<p>' + records.key190 +'&nbsp;'+ records.key1887 + records.key1888 + records.key1889 + records.key1890 + records.key1891 + records.key1892 + '</p><br/>'
		 + '<p>' + records.key191 + records.key1893 + records.key1894 + records.key1895 + records.key1896 + records.key1897 + "&nbsp;" +  records.key192 + "&nbsp;" + records.key1898 + records.key1899 +'&nbsp;'+ records.key1900 + '</p>'
		 + '</td></tr> ' 
		 + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/>'
		 //+ '<p>' + records.key193 + '.</p><br/>'
		 + '<p>' + records.key194 + records.key1901 + records.key1902 + records.key1903 + records.key1904 + '</p>'
		 + '</td></tr> ' 
		 + '<tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p><b><u>' + records.key195 + '</b></u></p><br/>'
		 + '<p>' + records.key196 +  records.key1905 +':</p><br/>'
		 + '<p> &nbsp;&nbsp;&nbsp;<b>1.</b> &nbsp; ' + records.key197 + '</p><br/>' 
		 + '<p> &nbsp;&nbsp;&nbsp;<b>2.</b> &nbsp; ' + records.key198 + '</p><br/>'
		 + '<p> &nbsp;&nbsp;&nbsp;<b>3.</b> &nbsp; ' + records.key199 + records.key1906 + records.key1907 + '</p><br/>'
		 + '<p> &nbsp;&nbsp;&nbsp;<b>4.</b> &nbsp; ' + records.key200 + records.key1908 + '</p>'
		 + '</td></tr> ' 
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p> &nbsp;&nbsp;&nbsp;<b>5.</b> &nbsp;  ' + records.key201 + '</p><br/>'
		 + '<p> &nbsp;&nbsp;&nbsp;<b>6.</b> &nbsp; ' + records.key202 + records.key1909 + '</p><br/>'
		 + '<p><b><u>' + records.key203 + '</b></u></p><br/>'
		 + '<p>' + records.key204 + records.key1910 +'</p><br/>'
		 + '<p>' + records.key205 + '</p><br/>'
		 + '<p>' + records.key206 + records.key1911 + records.key1912 + '</p>'
		 + '</td></tr> ' 
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p>' + records.key207 +'&nbsp;'+ records.key1913 + '</p><br/>'
		 + '<p>' + records.key208 + records.key1914 + records.key1915 + '</p><br/>'
		 + '<p>' + records.key209 + "&nbsp;" +records.key1916 + records.key1917 + '</p><br/>'
		 + '<p>' + records.key210 + '</p>'
		 + '</td></tr> ' 
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p><b><u>' + records.key211 + '</b></u></p><br/>'
		 + '<p>' + records.key212 + records.key1918 + '</p><br/>'
		 + '<p><b><u>' + records.key213 + '</b></u></p><br/>'
		 + '<p>' + records.key214 + records.key1919 + '</p><br/>'
		 + '<p><b><u>' + records.key215 + '</b></u></p><br/>'
		 + '<p>' + records.key216 + '</p><br/>'
		 + '<p>' + records.key217 + '</p>'
		 + '</td></tr> ' 
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p>' + records.key218 + records.key1920 + '</p><br/>'
		 + '<p>' + records.key219 + '</p><br/>'
		 + '<p>' + records.key220 + '</p><br/>'
		 + '<p>' + records.key221 + "&nbsp;" + records.key1921 + '</p>'
		 //+ '<p>' + records.key223 + '.</p>'
		 + '</td></tr> ' 
		 + ' <tr style="font:Trebuchet MS;font-size:15px;"><td id="inback" style="text-align:justify;padding-left:50px;padding-right:50px;"><br/><p><b><u>' + records.key222 + '</b></u></p><br/>'
		 + '<p>' + records.key223 + records.key1924 + records.key1925 + '</p><br/>'
		 + '<p>' + records.key224 + records.key1922 + records.key1923 +'&nbsp;'+ records.key225 + records.key1926 + '</p><br/>'
		//     + '<p>' + records.key225 + '</p><br/>'
		 + '<p><b><u>' + records.key226 + '</b></u></p><br/>'
		 + '<p>' + records.key227 + records.key1928 +'&nbsp;'+ records.key228 + records.key1929 + records.key1930 + records.key1931 + '</p><br/>'
		 + '<p><b><u>' + records.key229 + '</b></u></p><br/>'
		 + '<p>' + records.key230 + '</p>'
		 + '</td></tr> ' 
		 + ' </table>'
		 + '</div>'
		 + '</div>';
		 
	fleXenv.globalInit();
	fleXenv.initialized = false;
}

function jobClick() {
//	window.location = 'http://jobs.akeebo.com';
	window.location = 'mailto:jobs@akeebo.com';
}

function bloger() {
	window.open("http://blog.akeebo.com");
	return false;
}
function setting() {
	
	if(getCookie('customerId')) {
		var params = "customerId=" + parseInt(getCookie("customerId")) + "&locale=" + getCookie("locale");
		loadJspContent("settings", params);
	} else {
		login();
	}
	return false;
}

function lastPage() {
	wIndex--;
	if(wIndex < 0) {
		wIndex = 14;
	}
	getWidgets(wIndex);
	return 0;	
}
function nextPage() {
	wIndex++;
	if(wIndex > 14) {
		wIndex = 0;
	}
	getWidgets(wIndex);
	return 0;	
}

function designWidget(recFirst, recSecond) {
	var str = '<table width="100%">'
					+ '<tr>'
					+ '<td class="widgetHeader" >'
					+ recFirst
					+ '</td>'
					+ '</tr>'
					+ '<tr>'
					+ '<td class="widgetBubble" >'
					+ recSecond
					+ '</td>'
					+ '</tr>'
					+ '</table>';
	return str;
}

function getWidgets(j) {
	try {
	var background1 = document.getElementById('w01').style.background;
	var html1 = document.getElementById("widImg01").innerHTML;
	
	var background2 = document.getElementById('w02').style.background;
	var html2 = document.getElementById("widImg02").innerHTML;
	
	var background3 = document.getElementById('w03').style.background;
	var html3 = document.getElementById("widImg03").innerHTML;
	
	var background4 = document.getElementById('w04').style.background;
	var html4 = document.getElementById("widImg04").innerHTML;
	
	for(var k = 1; k < 5; k++) {
		var rand = Math.floor(Math.random() * 6);
		if (j == 1 && k == 1) {
				background1 = 'url("/ShowWidgets?value=5&icon=1&nocache=5") no-repeat';
				html1 = designWidget(records.key385, records.key1494 + records.key1495);
			} else if (j == 1 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=6&icon=1&nocache=6") no-repeat';
				html2 = designWidget(records.key47, records.key1496);
			}else if (j == 1 && k == 3) {
				background3 = 'url("/ShowWidgets?value=7&icon=1&nocache=7") no-repeat';
				html3 = designWidget(records.key1497, records.key1498); 
			}else if (j == 1 && k == 4) {
				background4 = 'url("/ShowWidgets?value=8&icon=1&nocache=8") no-repeat';
				html4 = designWidget(records.key387, records.key1499); 
			}else if (j == 2 && k == 1) {
				background1 = 'url("/ShowWidgets?value=9&icon=1&nocache=9") no-repeat';
				html1 = designWidget(records.key1500, records.key1501);
			}else if (j == 2 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=10&icon=1&nocache=10") no-repeat';
				html2 = designWidget(records.key1502, records.key1503); 
			}else if (j == 2 && k == 3) {
				background3 = 'url("/ShowWidgets?value=11&icon=1&nocache=11") no-repeat';
				html3 = designWidget(records.key49, records.key1504); 
			}else if (j == 2 && k == 4) {
				background4 = 'url("/ShowWidgets?value=12&icon=1&nocache=12") no-repeat';
				html4 = designWidget(records.key69, records.key1505);
			}else if (j == 3 && k == 1) {
				background1 = 'url("/ShowWidgets?value=13&icon=1&nocache=13") no-repeat';
				html1 = designWidget(records.key1506, records.key1507); 
			}else if (j == 3 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=14&icon=1&nocache=14") no-repeat';
				html2 = designWidget(records.key1508, records.key1509); 
			}else if (j == 3 && k == 3) {
				background3 = 'url("/ShowWidgets?value=15&icon=1&nocache=15") no-repeat';
				html3 = designWidget(records.key1510, records.key1511); 
			}else if (j == 3 && k == 4) {
				background4 = 'url("/ShowWidgets?value=16&icon=1&nocache=16") no-repeat';
				html4 = designWidget(records.key1512, records.key1513);
			}else if (j == 4 && k == 1) {
				background1 = 'url("/ShowWidgets?value=17&icon=1&nocache=17") no-repeat';
				html1 = designWidget(records.key66, records.key1514); 
			}else if (j == 4 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=18&icon=1&nocache=18") no-repeat';
				html2 = designWidget(records.key1515, records.key1516);
			}else if (j == 4 && k == 3) {
				background3 = 'url("/ShowWidgets?value=19&icon=1&nocache=19") no-repeat';
				html3 = designWidget(records.key1517, records.key1518);
			}else if (j == 4 && k == 4) {
				background4 = 'url("/ShowWidgets?value=20&icon=1&nocache=20") no-repeat';
				html4 = designWidget(records.key1519, records.key1520); 
			}else if (j == 5 && k == 1) {
				background1 = 'url("/ShowWidgets?value=21&icon=1&nocache=21") no-repeat';
				html1 = designWidget(records.key1521, records.key1522); 
			}else if (j == 5 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=22&icon=1&nocache=22") no-repeat';
				html2 =  designWidget(records.key73, records.key1523);
			}else if (j == 5 && k == 3) {
				background3 = 'url("/ShowWidgets?value=23&icon=1&nocache=23") no-repeat';
				html3 = designWidget(records.key1524, records.key1525); 
			}else if (j == 5 && k == 4) {
				background4 = 'url("/ShowWidgets?value=24&icon=1&nocache=24") no-repeat';
				html4 = designWidget(records.key703, records.key1526 + records.key1527);
			}else if (j == 6 && k == 1) {
				background1 = 'url("/ShowWidgets?value=25&icon=1&nocache=25") no-repeat';
				html1 = designWidget(records.key1528, records.key1529); 
			}else if (j == 6 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=26&icon=1&nocache=26") no-repeat';
				html2 = designWidget(records.key1530, records.key1531); 
			}else if (j == 6 && k == 3) {
				background3 = 'url("/ShowWidgets?value=27&icon=1&nocache=27") no-repeat';
				html3 = designWidget(records.key393, records.key1532);  
			}else if (j == 6 && k == 4) {
				background4 = 'url("/ShowWidgets?value=28&icon=1&nocache=28") no-repeat';
				html4 = designWidget(records.key1533, records.key1534);
			}else if (j == 7 && k == 1) {
				background1 = 'url("/ShowWidgets?value=29&icon=1&nocache=29") no-repeat';
				html1 = designWidget(records.key1535, records.key1536); 
			}else if (j == 7 && k == 2) {
				background2 = 'url("/ShowWidgets?value=30&icon=1&nocache=30") no-repeat';
				html2 = designWidget(records.key1537, records.key1538);
			}else if (j == 7 && k == 3) {
				background3 = 'url("/ShowWidgets?value=31&icon=1&nocache=31") no-repeat';
				html3 = designWidget(records.key1539, records.key1540);  
			}else if (j == 7 && k == 4) {
				background4 = 'url("/ShowWidgets?value=32&icon=1&nocache=32") no-repeat';
				html4 = designWidget(records.key1541, records.key1542); 
			}else if (j == 8 && k == 1) {
				background1 = 'url("/ShowWidgets?value=33&icon=1&nocache=33") no-repeat';
				html1 = designWidget(records.key1543, records.key1544);
			}else if (j == 8 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=34&icon=1&nocache=34") no-repeat';
				html2 = designWidget(records.key1530, records.key1545); 
			}else if (j == 8 && k == 3) {
				background3 = 'url("/ShowWidgets?value=35&icon=1&nocache=35") no-repeat';
				html3 = designWidget(records.key1546, records.key1547);
			}else if (j == 8 && k == 4) {
				background4 = 'url("/ShowWidgets?value=36&icon=1&nocache=36") no-repeat';
				html4 = designWidget(records.key1484, records.key1548); 
			}else if (j == 9 && k == 1) {
				background1 = 'url("/ShowWidgets?value=37&icon=1&nocache=37") no-repeat';
				html1 = designWidget(records.key1549, records.key1550);
			}else if (j == 9 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=38&icon=1&nocache=38") no-repeat';
				html2 = designWidget(records.key1551, records.key2044);
			}else if (j == 9 && k == 3) {
				background3 = 'url("/ShowWidgets?value=39&icon=1&nocache=39") no-repeat';
				html3 = designWidget(records.key1553, records.key1554);
			}else if (j == 9 && k == 4) {
				background4 = 'url("/ShowWidgets?value=40&icon=1&nocache=40") no-repeat';
				html4 = designWidget(records.key1555, records.key1556); 
			}else if (j == 10 && k == 1) {
				background1 = 'url("/ShowWidgets?value=41&icon=1&nocache=41") no-repeat';
				html1 = designWidget(records.key1557, records.key1558);
			}else if (j == 10 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=42&icon=1&nocache=42") no-repeat';
				html2 = designWidget(records.key101, records.key1559);
			}else if (j == 10 && k == 3) {
				background3 = 'url("/ShowWidgets?value=43&icon=1&nocache=43") no-repeat';
				html3 = designWidget(records.key1560, records.key1561);
			}else if (j == 10 && k == 4) {
				background4 = 'url("/ShowWidgets?value=44&icon=1&nocache=44") no-repeat';
				html4 = designWidget(records.key1562, records.key1563); 
			}else if (j == 11 && k == 1) {
				background1 = 'url("/ShowWidgets?value=45&icon=1&nocache=45") no-repeat';
				html1 = designWidget(records.key1564, records.key1565);
			}else if (j == 11 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=46&icon=1&nocache=46") no-repeat';
				html2 = designWidget(records.key1566, records.key1567);
			}else if (j == 11 && k == 3) {
				background3 = 'url("/ShowWidgets?value=47&icon=1&nocache=47") no-repeat';
				html3 = designWidget(records.key1568, records.key1569);  
			}else if (j == 11 && k == 4) {
				background4 = 'url("/ShowWidgets?value=48&icon=1&nocache=48") no-repeat';
				html4 = designWidget(records.key1570, records.key1571 + records.key1572); 
			}else if (j == 12 && k == 1) {
				background1 = 'url("/ShowWidgets?value=49&icon=1&nocache=49") no-repeat';
				html1 = designWidget(records.key1573, records.key1574);  
			}else if (j == 12 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=50&icon=1&nocache=50") no-repeat';
				html2 = designWidget(records.key1575, records.key1576);  
			}else if (j == 12 && k == 3) {
				background3 = 'url("/ShowWidgets?value=51&icon=1&nocache=51") no-repeat';
				html3 = designWidget(records.key1577, records.key1578 + records.key1579); 
			}else if (j == 12 && k == 4) {
				background4 = 'url("/ShowWidgets?value=52&icon=1&nocache=52") no-repeat';
				html4 = designWidget(records.key1580, records.key1581); 
			}else if (j == 13 && k == 1) {
				background1 = 'url("/ShowWidgets?value=53&icon=1&nocache=53") no-repeat';
				html1 = designWidget(records.key133, records.key1582 + records.key1583); 
			}else if (j == 13 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=54&icon=1&nocache=54") no-repeat';
				html2 = designWidget(records.key117, records.key1584); 
			}else if (j == 13 && k == 3) {
				background3 = 'url("/ShowWidgets?value=55&icon=1&nocache=55") no-repeat';
				html3 = designWidget(records.key1585, records.key1586 + records.key1587); 
			}else if (j == 13 && k == 4) {
				background4 = 'url("/ShowWidgets?value=56&icon=1&nocache=56") no-repeat';
				html4 = designWidget(records.key1588, records.key1589); 
			}else if (j == 14 && k == 1) {
				background1 = 'url("/ShowWidgets?value=57&icon=1&nocache=57") no-repeat';
				html1 = designWidget(records.key1590, records.key1591); 
			}else if (j == 14 && k == 2) {
				//alert("j = " + j + ", k = " + k);
				background2 = 'url("/ShowWidgets?value=58&icon=1&nocache=58") no-repeat';
				html2 = designWidget(records.key108, records.key1592); 
			}else if (j == 14 && k == 3) {
				background3 = 'url("/ShowWidgets?value=59&icon=1&nocache=59") no-repeat';
				html3 = designWidget(records.key1593, records.key1594);
			}else if (j == 14 && k == 4) {
				background4 = 'url("/ShowWidgets?value=60&icon=1&nocache=60") no-repeat';
				html4 = designWidget(records.key1595, records.key1596); 
			} else {
				if (j == 0 && k == 1) {
					background1 = 'url("/ShowWidgets?value=1&icon=1&nocache=1") no-repeat';
					html1 = designWidget(records.key1597, records.key1598); 
				}
				if (j == 0 && k == 2) {
					background2 = 'url("/ShowWidgets?value=2&icon=1&nocache=2") no-repeat';
					html2 = designWidget(records.key66, records.key1514); 
				}
				if (j == 0 && k == 3) {
					background3 = 'url("/ShowWidgets?value=3&icon=1&nocache=3") no-repeat';
					html3 = designWidget(records.key2046, records.key2045);  
				}
				if (j == 0 && k == 4) {
					background4 = 'url("/ShowWidgets?value=4&icon=1&nocache=4") no-repeat';
					html4 = designWidget(records.key1601, records.key1602); 
				}
		}
	}
	
	document.getElementById('w01').style.background = background1;
	document.getElementById('w02').style.background = background2;
	document.getElementById('w03').style.background = background3;
	document.getElementById('w04').style.background = background4;
	
	document.getElementById("widImg01").innerHTML = html1;
	document.getElementById("widImg02").innerHTML = html2;
	document.getElementById("widImg03").innerHTML = html3;
	document.getElementById("widImg04").innerHTML = html4;
	} catch(x) {
//		alert("error 32 " + x);
	}
	return false;
}

function emailValidation(list) {
	var  email = list.value;
	var i = email.indexOf('@');

	if(i < 2) {
		return false;
	}
	
	var username = email.substring(0 , i);
	var domain = email.substring(i + 1, email.length);
	i=0;
	while((username.substring(i , i + 1) == " ") && (i < username.length)) i++;

	if(i > 0) username = username.substring(i, username.length);
	
	i = domain.length - 1;
	while ((domain.substring(i, i + 1) == " ") && (i >= 0)) i-- ;
	if(i < (domain.length - 1)) domain = domain.substring(0, i + 1);

	var ch;
	for (i = 0; i < username.length; i++) {
		ch = (username.substring(i, i + 1)).toLowerCase();
		if(i==0) {
			if(!(((ch >= "a") && (ch <= "z")) || ((ch >= "0") && (ch <= "9")))) {		
				return false;
			}
		} else {
			if (!(((ch >= "a") && (ch <= "z")) || ((ch >= "0") && (ch <= "9")) ||(ch == "_") || (ch == "-") || (ch == "."))) {					
				return false;
			}
		}
	}

	for (i = 0; i < domain.length; i++) {
		ch = (domain.substring(i, i + 1)).toLowerCase();
		if(i==0) {
			if(!(((ch >= "a") && (ch <= "z")) || ((ch >= "0") && (ch <= "9")))) {			    	
			    return false;
			}
		} else {
			if (!(((ch >= "a") && (ch <= "z")) || ((ch >= "0") && (ch <= "9")) ||(ch == "_") || (ch == "-") || (ch == "."))) {		
			    return false;
			}
		}
	}

	var subdomainarray = new Array ();
	subdomainarray = [ ".com", ".edu" , ".us" , ".gov" , ".in" , ".mil" , ".net" , ".org" , ".info" , ".biz" , ".name" , ".pro" , ".museum" , ".coop" , ".aero", ".fr", ".ap", ".eu", ".ad", ".ae", ".af", ".ag", ".ai", ".al", ".am", ".an", ".ao", ".aq", ".ar", ".as", ".at", ".au", ".aw", ".az", ".ba", ".bb", ".bd", ".be", ".bf", ".bg", ".bh", ".bi", ".bj", ".bm", ".bn", ".bo", ".br", ".bs", ".bt", ".bv", ".bw", ".by", ".bz", ".ca", ".cc", ".cd", ".cf", ".cg", ".ch", ".ci", ".ck", ".cl", ".cm", ".cn", ".cr", ".cu", ".cv", ".cx", ".cy", ".cz", ".de", ".dJ", ".dk", ".dm", ".do", ".dz", ".ec", ".ee", ".eg", ".eh", ".er", ".es", ".et", ".fi", ".fJ", ".fk", ".fm", ".fo", ".fr", ".fx", ".ga", ".gb", ".gd", ".ge", ".gf", ".gh", ".gi", ".gl", ".gm", ".gn", ".gp", ".gq", ".gr", ".gs", ".gt", ".gu", ".gw", ".gy", ".hk", ".hm", ".hn", ".hr", ".ht", ".hu", ".id", ".ie", ".il", ".in", ".io", ".iq", ".ir", ".is", ".it", ".jm", ".jo", ".jp", ".ke", ".kg", ".kh", ".ki", ".km", ".kn", ".kp", ".kr", ".kw", ".ky", ".kz", ".la", ".lb", ".lc", ".li", ".lk", ".lr", ".ls", ".lt", ".lu", ".lv", ".ly", ".ma", ".mc", ".md", ".mg", ".mh", ".mk", ".ml", ".mm", ".mn", ".mo", ".mp", ".mq", ".mr", ".ms", ".mt", ".mu", ".mv", ".mw", ".mx", ".my", ".mz", ".na", ".nc", ".ne", ".nf", ".ng", ".ni", ".nl", ".no", ".np", ".nr", ".nu", ".nz", ".om", ".pa", ".pe", ".pf", ".pg", ".ph", ".pk", ".pl", ".pm", ".pn", ".pr", ".ps", ".pt", ".pw", ".py", ".qa", ".re", ".ro", ".ru", ".rw", ".sa", ".sb", ".sc", ".sd", ".se", ".sg", ".sh", ".si", ".sj", ".sk", ".sl", ".sm", ".sn", ".so", ".sr", ".st", ".sv", ".sy", ".sz", ".tc", ".td", ".tf", ".tg", ".th", ".tj", ".tk", ".tm", ".tn", ".to", ".tl", ".tr", ".tt", ".tv", ".tw", ".tz", ".ua", ".ug", ".um", ".us", ".uy", ".uz", ".va", ".vc", ".ve", ".vg", ".vi", ".vn", ".vu", ".wf", ".ws", ".ye", ".yt", ".rs", ".za", ".zm", ".me", ".zw", ".a1", ".a2", ".o1", ".ax", ".gg", ".im", ".je", ".bl", ".mf"];
	i=0;
	var subdomain = domain.substring(domain.lastIndexOf(".") , domain.length);
		for(i = subdomainarray.length -1 ; i >= 0 ; i--) {
		if((subdomain == subdomainarray [i])) {				
			i=-1;
		}
	}
	if(i == -1) {			
		return false;
	}		
	return true;
}	

function convertToEntities(data) {
	var tstr = data;
	var bstr = '';
	for(i=0; i<tstr.length; i++) {
		if(tstr.charCodeAt(i)>127) {
			bstr += '&#' + tstr.charCodeAt(i) + ';';
		} else {
			bstr += tstr.charAt(i);
		}
	}
	return bstr;
}
function sWidget(sText) {
//	var customerId = YAHOO.util.Cookie.get('customerId');
	var customerId = getCookie('customerId');
	var params = "customerId=" + customerId + "&search=" + sText;
	if(!customerId) {
		
	} else {
		loadJspContent("sideWidgets", params);
	}
	return false;
}
function handleClose() {
	var customerId = getCookie("customerId");
		if (customerId) {
			updateUserStatus (0);
		}
}