	var aaaButIDs = new Array();
	var aaaButObjects = new Array();
	aaaButIDs['rentallist'] = new Array();
	aaaButObjects['rentallist'] = new Array(); 
	aaaButIDs['rentallist']['all']=new Array("btnrental");
	aaaButIDs['rentallist']['one']=new Array("btnrental");
	aaaButIDs['rentallist']['mult']=new Array("btnrental");
	aaaButIDs['rentallist']['none'] = new Array();
	//download listing in my cart
	aaaButIDs['dnldlist'] = new Array();
	aaaButObjects['dnldlist'] = new Array(); 
	aaaButIDs['dnldlist']['all']=new Array("btndnld");
	aaaButIDs['dnldlist']['one']=new Array("btndnld");
	aaaButIDs['dnldlist']['mult']=new Array("btndnld");
	aaaButIDs['dnldlist']['none'] = new Array();
//trim the response of ajax
	function Trim(sString) {
	    while (sString.substring(0,1) == ' '){
	    sString = sString.substring(1, sString.length);
	    }
	    while (sString.substring(sString.length-1, sString.length) == ' '){
	    sString = sString.substring(0,sString.length-1);
	    }
	    return sString;
	} 
//set the header of action panel
	function setpanelheader(headertxt){
                sWhichPanel = "";
                YAHOO.freado.panel.actionpanel = new YAHOO.widget.Panel("panelcontainer",{width: "450px",fixedcenter:true,constraintoviewport:true,modal:false,draggable:false});
                YAHOO.freado.panel.actionpanel.setHeader(headertxt);
                YAHOO.freado.panel.actionpanel.setBody("<div id='panelbody'>"+loadingStr+"<\/div>");
                YAHOO.freado.panel.actionpanel.render();
                YAHOO.freado.panel.actionpanel.show();
	}
	var panelaction = "";
	var panelparam = "";
	var loadingStr = "<img src='"+ sImgSiteUrl+"loading.gif' \/>  Loading, Please wait...";
//function to toggle checkboxes within select and deselect
	function toggleChecked(oElement,strDatatableIndex){ 
	    oForm = oElement.form; 
	    oElement = oForm.elements[oElement.name];
		nChecked=0;
	    if(oElement.length){
	      bChecked = oElement[0].checked; 
	      for(i = 1; i < oElement.length; i++) {
	        oElement[i].checked = bChecked;
	        if(bChecked)nChecked++;
	      }
	    }
	    dt_checkbox_update_but_states(nChecked,strDatatableIndex); 
	}
//function to toggle checkboxes within select and deselect
	function toggleIndeterminate(oElement,strDatatableIndex){ 
	    oForm = oElement.form; 
	    oElement = oForm.elements[oElement.name]; 
	    if(oElement.length){
	      bIndeterminate = false; 
	      bChecked = true; 
	      nChecked = 0; 
	      for(i = 1; i < oElement.length; i++) 
	        if(oElement[i].checked){nChecked++;}           
			if(nChecked < oElement.length - 1){	
	        if(nChecked){
	          bIndeterminate = true; 
	        }else{ 
	          bIndeterminate = false; 
	        } 
	        bChecked = false; 
	      }else{ 
	        bIndeterminate = false; 
	      } 
	      oElement[0].checked = bChecked; 
	    } 
	    dt_checkbox_update_but_states(nChecked,strDatatableIndex);
	}	
//function to enable buttons if checboxes are clicked
	function dt_checkbox_update_but_states(numSelRows,strDatatableIndex) {
		switch (numSelRows) {
	    case 0 :
	      asTempButs = aaaButIDs[strDatatableIndex]['none'];
	      break;
	    case 1 :
	      asTempButs = aaaButIDs[strDatatableIndex]['one'];
	      break;
	    default :
	      asTempButs = aaaButIDs[strDatatableIndex]['mult'];
	      break;
	    }
	
	    var sTempButs = asTempButs.join(",");
	    var numButs = aaaButIDs[strDatatableIndex]['all'].length;
	    for ( var i=0; i < numButs; i++ ) {
	        var strButID = aaaButIDs[strDatatableIndex]['all'][i];
	        var oBut = document.getElementById(strButID);
	        if( oBut ) {
	        oBut.disabled = (sTempButs.indexOf(strButID) == -1);
	        }
	    }
	}	
//handlisng ajax response failure
	function ResponseFailure(o){}
//handling ajax response success
	function handleResponse(o){
		if (o && o.responseText && Trim(o.responseText).length >= 1) {
		 	var sRes = Trim(o.responseText);
		 	if(o.argument){
		 	 	if(o.argument.div){
		 	 	 var obj = document.getElementById(o.argument.div);
		 	 	 if(obj){
		 	 	  	if(o.argument.div == "panelbody" && o.argument.reqtype == "result"){
						aData = sRes.split("^A");
						if(aData[0]=="pass"){
						 	obj.innerHTML = "";
						 	obj.innerHTML = "<div class='status_pass' style='padding:4px 0px 4px 20px;text-align:center;'>"+aData[1]+"<\/div>";
							if(sLocation!=""){
								window.location=sLocation;
							}	
						}
						if(aData[0]=="fail"){
							obj.innerHTML = "";
						 	obj.innerHTML = "<div class='status_warn' style='padding:4px 0px 4px 20px;text-align:center;'>"+aData[1]+"<\/div>";
						 	if(aData[1]=="You cannot add yourself as favourate"){
								if(sLocation!=""){
									window.location=sLocation;
								}
							}
						 	/*var obj1 = document.getElementById('status_warn');
						 	if(obj1){
						 	 	obj1.style.display="block";
								obj1.innerHTML = aData[1];	
							}else{
								var obj2 = document.getElementById('panelbody');
								obj2.innerHTML = "";
								if(obj2){
									var sD = document.createElement('div');
									sD.setAttribute('id', 'status_warn');
									sD.setAttribute('class', 'status_warn');
									obj2.insertBefore(sD,obj2.firstChild);
									document.getElementById('status_warn').innerHTML = aData[1];	
								}
							}*/
						} 
					}else{
					 	if(o.argument.reqtype){
						 	if(o.argument.reqtype == "result" || o.argument.reqtype == "status" ){
								aData = sRes.split("^A");
								if(aData[0]=="pass"){
								 	obj.innerHTML = "";
								 	obj.innerHTML = "<div class='status_pass' style='padding:4px 0px 4px 20px;text-align:center;'>"+aData[1]+"<\/div>";
									if(sLocation!=""){
										window.location=sLocation;
									}
								}else{
									obj.innerHTML = "";
								 	obj.innerHTML = "<div class='status_warn' style='padding:4px 0px 4px 20px;text-align:center;'>"+aData[1]+"<\/div>";	
								 	if(aData[1]=="You cannot add yourself as favourate"){
										if(sLocation!=""){
											window.location=sLocation;
										}
									}
									if (txtfield = document.getElementById('anonymous_email')){
										if(document.getElementById('anonymous_email').value==""){
											setTimeout("document.getElementById('anonymous_email').focus()",100);
										}
									}
									//setting the focus to the password field in case of login while favouriting
									if (txtfield = document.getElementById('password')){
										if(document.getElementById('anonymous_email').value!=""){
											setTimeout("document.getElementById('password').focus()",100);
										}
								 	}
								}
							}
						}else{
							obj.innerHTML = sRes;
						}
		 	 	  		
		 	 	  	}
				 }
		 		}
		 		if(o.argument.callback){
					o.argument.callback();
				}
			}
		}
	}
//ajax call to panel_mail and print the result in div
	function panel_loadbody(req){
		var sUrl = sBaseUrl+'panel_main.php?action='+panelaction+panelparam+'&rand='+Math.random();
		var callback = {success: handleResponse,failure:ResponseFailure,argument: {div:"panelbody",reqtype:req}};
		var cObj = YAHOO.util.Connect.asyncRequest('GET',sUrl, callback);	
	}
//show if panel is loading
	function show_panel_loading(divid){
	 	var obj1 = document.getElementById(divid);
	 	if(obj1){
	 	 	obj1.style.display="block";
	 	 	obj1.innerHTML = loadingStr;
		}
	}
//add the user as friend
	function alert_friend(tp,id,url){
		sLocation = url;
		setpanelheader("Add as Friend");
		panelaction = tp;
		panelparam = '&puid='+id+"&reload_url="+url;
		panel_loadbody('result');
	}
//function to add content as fav	
	function addfav(id,name,type,url){
		sLocation = url;
		message="Add this "+type+" as favourite";
	 	setpanelheader(message);
	 	panelaction="addfav";
		panelparam="&id="+id+"&name="+name+"&type="+type+"&reload_url="+url;
		panel_loadbody('status');	
	}
	
	//function to add anonymous fan
	function addAnonymousFav(id,name,type,anonymous_name,anonymous_email,anonymous_url,txt_captcha,errmsg,existing,anonymousid,url){
		var sCaptcha="";
		//////Ajax to get the Captcha session value/////////
		var xmlHttp;
		var sessionVal;
		try
  		{
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  		}
		catch (e)
  		{
  			// Internet Explorer
  			try
    		{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  			catch (e)
    		{
    			try
      			{
      				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      			}
    			catch (e)
      			{
      				return false;
      			}
    		}
  		}
  		xmlHttp.open("GET",sBaseUrl+"includes/getCaptchaSession.php",true);
		xmlHttp.send(null);
  		xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
    		{    			
    			sCaptcha=xmlHttp.responseText;
      			if((anonymous_name=="Full Name" || anonymous_name=="") && existing==0){
					document.getElementById(errmsg).innerHTML="Please enter your name";
				}else if((!echeckEmail(anonymous_email)) && existing==0){
					document.getElementById(errmsg).innerHTML="Please enter the valid Email ID";
				}else if(txt_captcha!=sCaptcha && existing==0){
					document.getElementById(errmsg).innerHTML="Please Enter correct code";
				}else{
				 	panelaction="addanonymousfav";
				 	if(anonymous_url=="Website"){ anonymous_url=""; }
				 	if(existing==0){
						panelparam="&id="+id+"&name="+name+"&type="+type+"&anonymous_name="+anonymous_name+"&anonymous_email="+anonymous_email+"&anonymous_url="+anonymous_url+"&exist=0&reload_url="+url;
					}else{
						panelparam="&id="+id+"&name="+name+"&type="+type+"&anonymous_name="+anonymous_name+"&anonymous_email="+anonymous_email+"&anonymous_url="+anonymous_url+"&exist=1&anonymousid="+anonymousid+"&reload_url="+url;
					}
					panel_loadbody('status');
				}	
      		}
    	}
	}
	//function to send mail to the author
	function sendAccount(author_id,creator_id,url){
		sLocation = url;
		message="Send account details to author";
	 	setpanelheader(message);
	 	panelaction="sendaccount";
		panelparam="&id="+author_id+"&creator_id="+creator_id+"&reload_url="+url;
		panel_loadbody('status');	
	}
	//function to delete book/user from fav. list	
	function deletefav(id,name,type,url){
		sLocation = url;
		message="Delete this "+type+" from favourite list";
	 	setpanelheader(message);
	 	panelaction="deletefav";
		panelparam="&id="+id+"&name="+name+"&type="+type+"&reload_url="+url;
		panel_loadbody('status');	
	}
	//function to delete comments
	function deletecomment(to_id,comm_id,url){
		sLocation = url;
		message="Delete this comment from comments";
		setpanelheader(message);
		panelaction="deletecomment";
		panelparam="&id="+to_id+"&comment_id="+comm_id+"&reload_url="+url;
		panel_loadbody('status');
	}
//function to add the content to wishlist
	function addwish(id,name,type,url){
		sLocation = url;
		message="Add this"+type+" in your wishlist";
	 	setpanelheader(message);
	 	panelaction="addwish";
		panelparam="&id="+id+"&name="+name+"&type="+type+"&reload_url="+url;
		panel_loadbody('status');	
	}
	//function to delete the content from wishlist
	function deletewish(id,name,type,url){
		sLocation = url;
		message="Delete this"+type+" from your wishlist";
	 	setpanelheader(message);
	 	panelaction="deletewish";
		panelparam="&id="+id+"&name="+name+"&type="+type+"&reload_url="+url;
		panel_loadbody('status');	
	}
//function to report a content as abused
	function reportabuse(id,name,type,url){
		sLocation = url;
		message="Report this "+type+" abuse";
	 	setpanelheader(message);
	 	panelaction="reportabuse";
		panelparam="&id="+id+"&name="+name+"&type="+type+"&reload_url="+url;
		panel_loadbody('status');	
	}
	
	//function to log in
	function userLogin(id,email,password,remember,user_website,url,type,name){
		sLocation = url;
		if(remember){
			remember="on";
		}else{
			remember="";
		}
		if(!echeckEmail(email)){
			document.getElementById('errmsg').innerHTML="Please enter the valid Email ID";
			document.getElementById('anonymous_email').focus();
		}else if(password==""){
			document.getElementById('errmsg').innerHTML="Please enter your password";
			document.getElementById('password').focus();
		}else{
			panelaction="userlogin";
			panelparam="&id="+id+"&type="+type+"&name="+name+"&email="+email+"&password="+password+"&user_website="+user_website+"&reload_url="+url+"&chk_remember="+remember;
			panel_loadbody('status');
		}
	}
//function that returns the list of all values of checkboxes within a given form
function get_all_val(frm){
    var aData = new Array();
    if(frm == ""){
    	var oForm = document.frmlist;
    }else{
		var oForm = eval("document."+frm);
	}
	
    oElement = oForm.elements['chklist'];
    nChecked=0;
    if(oElement.length){ 
      for(i = 1; i < oElement.length; i++) {
        	aData.push(oElement[i].value);
      }
    }
    return aData;
}
//function that returns the list of selected items by checkboxes of a given form
function get_selected_val(frm){
    var aData = new Array();
    if(frm == ""){
    	var oForm = document.frmlist;
    }else{
		var oForm = eval("document."+frm);
	 }
	
    oElement = oForm.elements['chklist'];
    nChecked=0;
    if(oElement.length){ 
      for(i = 1; i < oElement.length; i++) {
        if(oElement[i].checked){
        	aData.push(oElement[i].value);
		}
      }
    }
    return aData;
}
	//function to validate and submit the search form
function srch(){
    oB = document.frmsearch.vl;
    if(Trim(oB.value)==''){
	   	alert('Search value cannot be empty');
    	oB.focus();
    	return false;
	}else{
			document.frmsearch.submit();
		}
}
	//function to clear the search text box when user clicks on it
	function clearsrch(obj,tp){
			if((Trim(obj.value) == "Search") && tp=="1"){
				obj.value = "";
			}
			if(Trim(obj.value) == "" && tp=="2"){
					obj.value = "Search";
			}
	}
	//function to show loading when we click to open the panel
	function loading_panel(){
		YAHOO.freado.panel.wait = new YAHOO.widget.Panel("wait",{width:"240px",fixedcenter:true, close:false, draggable:false, zindex:4,modal:true,visible:false});
		YAHOO.freado.panel.wait.setHeader("Loading, please wait...");
		YAHOO.freado.panel.wait.setBody('<img src="images/loading_bar.gif" />');
		YAHOO.freado.panel.wait.render("loading_panel");
		YAHOO.freado.panel.wait.show();
	}
	//function to launch the audio player
	function playaudio(contentid,preview){
		strWidth = "500";
		strHeight = "20";
		tools = "maximize=no,resizable=no,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
		url = sBasePlayerUrl+"popcheck.php?contentid="+contentid+"&preview="+preview;
		newWindow = window.open(url, 'newWin', tools);
		if(!newWindow){
			alert('Please enable popup window from Freado in your browser');
		}else{
		 	newWindow.focus();
		}
	}
	//function to launch the video player
	function playvideo(contentid,preview){
		strWidth = "510";
		strHeight = "410";
		tools = "width="+strWidth+",height="+strHeight+",left=0,top=0";
		url = sBasePlayerUrl+"videoplayer.php?contentid="+contentid+"&preview="+preview;
		newWindow = window.open(url, 'newWin', tools);
		if(!newWindow){
			alert('Please enable popup window from Freado in your browser');
		}else{
		 	newWindow.focus();
		}
	}
	//function to launch the book player
	function playbook(contentid,authorid,preview){
		strWidth = screen.width;
		strHeight = screen.height;
		tools = "width="+strWidth+",height="+strHeight+",left=0,top=0";
		url = sBasePlayerUrl+"bookplayer.php?contentid="+contentid+"&authorid="+authorid+"&preview="+preview;
		newWindow = window.open(url, 'newWin', tools);
		if(!newWindow){
			alert('Please enable popup window from Freado in your browser');
		}else{
		 	newWindow.focus();
		}
	}
	function checkLength(field, max) {
		// if the length of the string in the input field is greater than the max value, trim it
		if (field.value.length > max)
			field.value = field.value.substring(0, max);
	}
	 function checkFileExtension(elem) {
        var filePath = elem.value;

        if(filePath.indexOf('.') == -1)
            return false;
        
        var validExtensions = new Array();
        var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();
    
        validExtensions[0] = 'jpg';
        validExtensions[1] = 'jpeg';
        validExtensions[3] = 'png';
        validExtensions[4] = 'gif';  
    
        for(var i = 0; i < validExtensions.length; i++) {
            if(ext == validExtensions[i]){
            	loading_panel();
				return true;
			}
        }

        alert('The file extension ' + ext.toUpperCase() + ' is not allowed!');
        return false;
    }
    function changeCaptcha(myForm)
	{
		var xmlHttp;
		try
  		{
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  		}
		catch (e)
  		{
  			// Internet Explorer
  			try
    		{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  			catch (e)
    		{
    			try
      			{
      				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      			}
    			catch (e)
      			{
      				return false;
      			}
    		}
  		}
  		xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
    		{
      			myForm.imgcaptcha.src=xmlHttp.responseText;
      			myForm.txt_captcha.value="";
      			myForm.txt_captcha.focus();
      		}
    	}
  		xmlHttp.open("GET",sBaseUrl+"includes/getCaptcha.php",true);
		xmlHttp.send(null);
	}
	
	//function to ceheck any new text is written to the text field. If written do not clear else clear it
	function checkText(text){
		if(text.name=='txt_guestname'){
			if(text.value=="Full Name"){
				text.value="";
			}
		}else if(text.name=='txt_guestemail'){
			if(text.value=="Email"){
				text.value="";
			}
		}else if(text.name=='txt_guesturl'){
			if(text.value=="Website"){
				text.value="";
			}
		}else if(text.name=='txt_captcha'){
			if(text.value=="Type the code shown above"){
				text.value="";
			}
		}
	}
	
	//function to check whther any filed is having null values in anonymous favorating form
	function checkNull(text){
		if(text.name=='txt_guestname'){
			if(text.value==""){
				text.value="Full Name";
			}
		}else if(text.name=='txt_guestemail'){
			if(text.value==""){
				text.value="Email";
			}
		}else if(text.name=='txt_guesturl'){
			if(text.value==""){
				text.value="Website";
			}
		}else if(text.name=='txt_captcha'){
			if(text.value==""){
				text.value="Type the code shown above";
			}
		}
	}
	
	//function to validate email id
	function echeckEmail(str) {
		return (str.lastIndexOf(".") > 2) && (str.indexOf("@") > 0) && (str.lastIndexOf(".") > (str.indexOf("@")+1)) && (str.indexOf("@") == str.lastIndexOf("@"));
	} 
	/*function echeckEmail(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}*/
	function checkTweetLength(e,obj,url_len,flg){
		if(e.keyCode!=8 && e.keyCode!=46 && e.keyCode!=39 && e.keyCode!=37 && e.keyCode!=38 && e.keyCode!=40){
			if(flg==3){
				if((obj.value.length+url_len+22)>=140){
					obj.value=obj.value.substring(0,140);
					return false;
				}
			}else{
				if((obj.value.length+url_len+3)>=140){
					obj.value=obj.value.substring(0,140);
					return false;
				}
			}
		}
	}
	
	function enableTweet(id){
		var txt="txt_"+id;
		var chk="chk_"+id;
		if(document.getElementById(chk).checked){
			document.getElementById(txt).disabled=false;
			document.getElementById(txt).focus();
		}else{
			document.getElementById(txt).disabled=true;
		}
		if(chk=="chk_autotweet"){
			if(document.getElementById(chk).checked){
				document.getElementById("opt_day").disabled=false;
				document.getElementById("opt_week").disabled=false;
				if(document.getElementById("opt_week").checked==true){
					document.getElementById("slct_weekday").disabled=false;
				}else{
					document.getElementById("slct_weekday").disabled=true;
				}
				//document.getElementById("txt_daytime").disabled=false;
				//document.getElementById("slct_daytime").disabled=false;
				//document.getElementById("txt_weektime").disabled=false;
				//document.getElementById("slct_weektime").disabled=false;
			}else{
				document.getElementById("opt_day").disabled=true;
				document.getElementById("opt_week").disabled=true;
				//document.getElementById("txt_daytime").disabled=true;
				//document.getElementById("slct_daytime").disabled=true;
				document.getElementById("slct_weekday").disabled=true;
				//document.getElementById("txt_weektime").disabled=true;
				//document.getElementById("slct_weektime").disabled=true;
			}
		}
	}
	function showDivTweets(){
		var divTwitter=document.getElementById("divTweets");
		divTwitter.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTwitter.style.width.substring(0,(divTwitter.style.width.length-2)))/2;
		top=(myHeight-divTwitter.style.height.substring(0,(divTwitter.style.height.length-2)))/2;
		divTwitter.style.left = left+"px";
		divTwitter.style.top = "150px";
	}
	function hideDivTweets(){
		var divTwitter=document.getElementById("divTweets");
		divTwitter.style.visibility="hidden";
	}
	function showTwitterDetails(){
		var divTwitter=document.getElementById("divTwitter");
		divTwitter.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTwitter.style.width.substring(0,(divTwitter.style.width.length-2)))/2;
		top=(myHeight-divTwitter.style.height.substring(0,(divTwitter.style.height.length-2)))+document.body.scrollTop;
		divTwitter.style.left = left+"px";
		divTwitter.style.top = top+"px";
		document.getElementById("twitter_username").focus();
	}
	function hideTwitterDetails(){
		var divTwitter=document.getElementById("divTwitter");
		divTwitter.style.visibility="hidden";
	}
	function fixDivTwitter(){
		var divTwitter=document.getElementById("divTwitter");
		if(divTwitter.style.visibility=="visible"){
			showTwitterDetails();
		}
	}
	function showTwitter(){
		var divTwitter=document.getElementById("divTweets");
		divTwitter.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTwitter.style.width.substring(0,(divTwitter.style.width.length-2)))/2;
		top=(myHeight-divTwitter.style.height.substring(0,(divTwitter.style.height.length-2)))/2+document.body.scrollTop;
		top=200+document.body.scrollTop;
		divTwitter.style.left = left+"px";
		divTwitter.style.top = top+"px";
	}
	function hideTwitter(){
		var divTwitter=document.getElementById("divTweets");
		divTwitter.style.visibility="hidden";
		hideChangeTimezone();
	}
	function showTweetnow(){
		var divTwitter=document.getElementById("divTweetnow");
		divTwitter.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTwitter.style.width.substring(0,(divTwitter.style.width.length-2)))/2;
		top=(myHeight-divTwitter.style.height.substring(0,(divTwitter.style.height.length-2)))/2+document.body.scrollTop;
		divTwitter.style.left = left+"px";
		divTwitter.style.top = top+"px";
		document.getElementById("btn_tweetnow").style.visibility="visible";
		document.getElementById("txt_tweetnow").focus();
		hideTwitter();
	}
	function hideTweetnow(){
		var divTwitter=document.getElementById("divTweetnow");
		divTwitter.style.visibility="hidden";
		divTwitter.style.left="0px";
		document.getElementById("btn_tweeted").style.visibility="hidden";
		document.getElementById("btn_tweeted").style.position="absolute";
		document.getElementById("btn_tweetnow").style.visibility="hidden";
		document.getElementById("btn_tweetnow").style.position="relative";
		//showTwitter();
	}
	function showPreview(txt_area,short_url,flg){
		var flgStep="";
		if(flg==4){
			txt_area="txt_bookopentweet";
			flgStep=flg;
			flg=flg-1;
		}
		obj=document.getElementById(txt_area);
		var lbl="lblpreview"+flg;
		var lblcnt="lblcharcount"+flg;
		var objPrev=document.getElementById(lbl);
		var objCharCount=document.getElementById(lblcnt);
		objPrev.innerHTML="";
		if(flg==3){
			objPrev.innerHTML="<textarea readonly='readonly'  style='width:400px;height:49px;border:1px solid #99f;' >"+obj.value+" - by N Readers - "+short_url+"</textarea>";
		}else{
			objPrev.innerHTML="<textarea readonly='readonly'  style='width:400px;height:49px;border:1px solid #99f;' >"+obj.value+" - "+short_url+"</textarea>";
		}
		if(flg==3){
			objCharCount.innerHTML= 140-obj.value.length-short_url.length-22;
		}else{
			objCharCount.innerHTML= 140-obj.value.length-short_url.length-3;
		}
		//obj.value=trim(obj.value);
		if(trim(obj.value)==""){
			if(flg==1){
				document.getElementById("btn_tweetnow").disabled=true;
				document.getElementById("btn_tweetnow").src="../../cdn/img/site/tweetnowdisbled.gif";
			}else{
				document.getElementById("save").disabled=true;
			}
		}else{
			if(flg==1){
				if((objCharCount.innerHTML= 140-obj.value.length-short_url.length-3)<0){
					document.getElementById("btn_tweetnow").disabled=false;
					document.getElementById("btn_tweetnow").src="../../cdn/img/site/tweetnowdisbled.gif";
				}else{
					document.getElementById("btn_tweetnow").disabled=false;
					document.getElementById("btn_tweetnow").src="../../cdn/img/site/tweetnow.gif";
				}
			}else{
				if(trim(obj.value)!=""){
					if(flg==3){
						if((objCharCount.innerHTML= 140-obj.value.length-short_url.length-22)<0){
							obj.value=obj.value.substring(0,140-short_url.length-22);
							//document.getElementById("save").disabled=true;
						}else{
							//obj.value=obj.value.substring(0,140);
							document.getElementById("save").disabled=false;
						}
					}else{
						if((objCharCount.innerHTML= 140-obj.value.length-short_url.length-3)<0){
							obj.value=obj.value.substring(0,140-short_url.length-3);
							//document.getElementById("save").disabled=true;
						}else{
							//obj.value=obj.value.substring(0,140);
							document.getElementById("save").disabled=false;
						}
					}
				}else{
					document.getElementById("save").disabled=true;
				}
			}
		}
		if(flgStep==4){
			txt_area="txt_autotweet";
			showPreview(txt_area,short_url,2);
		}
	}
	function tweetNow(shortUrl,accountid,contentid){
		var objTweet=document.getElementById("txt_tweetnow");
		var message=objTweet.value+" - "+shortUrl;
		message=encodeURIComponent(message);
		var xmlHttp;
		try
  		{
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  		}
		catch (e)
  		{
  			// Internet Explorer
  			try
    		{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  			catch (e)
    		{
    			try
      			{
      				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      			}
    			catch (e)
      			{
      				return false;
      			}
    		}
  		}
  		xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
    		{
    			if(xmlHttp.responseText==1){
					document.getElementById("btn_tweetnow").style.visibility="hidden";
					document.getElementById("btn_tweetnow").style.position="absolute";
					document.getElementById("btn_tweeted").style.visibility="visible";
					document.getElementById("btn_tweeted").style.position="relative";
				}else if(xmlHttp.responseText==401){
					alert("Tweet failed. Please reconnect with twitter");
				}
      		}
    	}
  		xmlHttp.open("GET",sBaseUrl+"users/tweetNow.php?msg="+message+"&accountid="+accountid+"&contentid="+contentid,true);
		xmlHttp.send(null);
	}
	function showAutoTweets(){
		var divTwitter=document.getElementById("divAutoTweet");
		divTwitter.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTwitter.style.width.substring(0,(divTwitter.style.width.length-2)))/2;
		top=(myHeight-divTwitter.style.height.substring(0,(divTwitter.style.height.length-2)))/2+document.body.scrollTop;
		//top=150+document.body.scrollTop;
		divTwitter.style.left = left+"px";
		divTwitter.style.top = top+"px";
		hideTwitter();
	}
	function hideAutoTweet(){
		var divTwitter=document.getElementById("divAutoTweet");
		divTwitter.style.visibility="hidden";
		document.getElementById("btn_tweeted").style.visibility="hidden";
		showTwitter();
		closeLearnMore();
	}
	function closeNewFeatureDiv(){
		var objDiv=document.getElementById("divNewFeature");
		objDiv.style.visibility="hidden";
		objDiv.style.position="absolute";
	}
	function getBookSignature(contentid,signURL){
		var objDiv=document.getElementById("divSignature");
		var objImg=document.getElementById("imgSignature");
		var objImgBtn=document.getElementById("btnGetSign");
		var objDivGetSign=document.getElementById("divGetSign");
		var objDivProcessing=document.getElementById("divProcessing");
		var objDivSignHead=document.getElementById("divSignHead");
		var objDivSignSteps=document.getElementById("divSignSteps");
		objImgBtn.src="../../cdn/img/site/loading.gif";
		objImg.src="../../cdn/img/site/loading.gif";
		objDivProcessing.style.visibility="visible";
		var xmlHttp;
		try
  		{
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  		}
		catch (e)
  		{
  			// Internet Explorer
  			try
    		{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  			catch (e)
    		{
    			try
      			{
      				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      			}
    			catch (e)
      			{
      				return false;
      			}
    		}
  		}
  		xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
    		{
    			if(xmlHttp.responseText==1){
    				objDivSignHead.style.visibility="visible";
    				objDivSignHead.style.position="relative";
					objDiv.style.visibility="visible";
					objDiv.style.position="relative";
					objImg.src=signURL;
					objDivGetSign.style.visibility="hidden";
					objDivGetSign.style.position="absolute";
					objDivProcessing.style.visibility="hidden";
					objDivProcessing.style.position="absolute";
					objDivSignSteps.style.visibility="visible";
					objDivSignSteps.style.position="relative";
					objImgBtn.src="";
				}else{
					objDivProcessing.style.visibility="hidden";
					alert("There was some Processing error. Please try agail later.");
					objImgBtn.src="../../cdn/img/site/getbooksignature.gif";
				}
      		}
    	}
  		xmlHttp.open("GET",sBaseUrl+"scripts/bookBuzzrSignature.php?contentid="+contentid);
		xmlHttp.send(null);
	}
	
	function toggleGraph(state){
		var objGraph=document.getElementById("divGraphs");
		var objBgraph=document.getElementById("divB_Grph");
		var objWgraph=document.getElementById("divW_Grph");
		var objBtab=document.getElementById("spanB");
		var objWtab=document.getElementById("spanW");
		if(state==0){
			objGraph.innerHTML=objBgraph.innerHTML;
			objWtab.style.backgroundColor="#FFEDF4";
			objBtab.style.backgroundColor="#B6D6FA";
		}
		if(state==1){
			objGraph.innerHTML=objWgraph.innerHTML;
			objBtab.style.backgroundColor="#E9F3FF";
			objWtab.style.backgroundColor="#F09BB9";
		}
	}
	
	function getVcard(account_id,content_id){
		var xmlHttp;
		try
  		{
  			// Firefox, Opera 8.0+, Safari
  			xmlHttp=new XMLHttpRequest();
  		}
		catch (e)
  		{
  			// Internet Explorer
  			try
    		{
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  			catch (e)
    		{
    			try
      			{
      				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      			}
    			catch (e)
      			{
      				return false;
      			}
    		}
  		}
  		xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
    		{
    			//xmlHttp.responseText==1
    			document.location = sBaseUrl+"cdn/vcard/"+account_id+".vcf";
      		}
    	}
  		xmlHttp.open("GET",sBaseUrl+"scripts/getVcard.php?account_id="+account_id+"&contentid="+content_id);
		xmlHttp.send(null);
	}
	
	function getHcard(){
		var objhCard=document.getElementById("hCard");
		var objhCardVal=document.getElementById("hCard");
		objhCard.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var left="";
		var top="";
		left=(myWidth-objhCard.style.width.substring(0,(objhCard.style.width.length-2)))/2;
		top=(myHeight-objhCard.style.height.substring(0,(objhCard.style.height.length-2)))/2+document.body.scrollTop;
		objhCard.style.left = (left-10)+"px";
		//objhCard.style.top = (top)+"px";
	}
	
	function closeHcard(){
		var objhCard=document.getElementById("hCard");
		objhCard.style.visibility="hidden";
	}
	
	function showCardDesc(flag){
		if(flag==0){
			var objCard=document.getElementById("divVcardDesc");
			//closeCardDesc(1);
		}else{
			var objCard=document.getElementById("divHcardDesc");
			//closeCardDesc(0)
		}
		objCard.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-objCard.style.width.substring(0,(objCard.style.width.length-2)))/2;
		top=(myHeight-objCard.style.height.substring(0,(objCard.style.height.length-2)))/2+document.body.scrollTop;
		objCard.style.left = (left-10)+"px";
		//objCard.style.top = top+"px";
	}
	
	function closeCardDesc(flag){
		if(flag==0){
			var objCard=document.getElementById("divVcardDesc");
		}else{
			var objCard=document.getElementById("divHcardDesc");
		}
		objCard.style.visibility="hidden";
		objCard.style.left = "0px";
		//objCard.style.top = "0px";
	}
	
	function showTwitterInfo(){
		var divTwitterInfo=document.getElementById("divTwitterInfo");
		divTwitterInfo.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTwitterInfo.style.width.substring(0,(divTwitterInfo.style.width.length-2)))/2;
		top=(myHeight-divTwitterInfo.style.height.substring(0,(divTwitterInfo.style.height.length-2)))/2+document.body.scrollTop;
		top=150+document.body.scrollTop;
		divTwitterInfo.style.left = left+"px";
		divTwitterInfo.style.top = top+"px";
	}
	function hideTwitterInfo(){
		var divTwitterInfo=document.getElementById("divTwitterInfo");
		divTwitterInfo.style.visibility="hidden";
		divTwitterInfo.style.left = "0px";
		divTwitterInfo.style.top = "0px";
	}
	
	function showTimezone(){
		var divTimezone=document.getElementById("divTimezone");
		divTimezone.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divTimezone.style.width.substring(0,(divTimezone.style.width.length-2)))/2;
		top=(myHeight-divTimezone.style.height.substring(0,(divTimezone.style.height.length-2)))/2+document.body.scrollTop;
		divTimezone.style.left = left+"px";
		divTimezone.style.top = top+"px";
		//hideTwitterInfo();
	}
	function hideTimezone(){
		var divTimezone=document.getElementById("divTimezone");
		divTimezone.style.visibility="hidden";
		divTimezone.style.left = "0px";
		divTimezone.style.top = "0px";
		//showTwitterInfo();
	}
	function showChangeTimezone(){
		var divChangeTimezone=document.getElementById("divChangeTimezone");
		divChangeTimezone.style.visibility="visible";
		divChangeTimezone.style.position="static";
	}
	function hideChangeTimezone(){
		var divChangeTimezone=document.getElementById("divChangeTimezone");
		divChangeTimezone.style.visibility="hidden";
		divChangeTimezone.style.position="absolute";
	}
	
	function showSelectTime(daytime){
		var objDivTime=document.getElementById("divTime");
		var objDivDayTime=document.getElementById("divDayTime");
		
		if(daytime==0){
			objDivTime.style.visibility="visible";
			objDivDayTime.style.visibility="hidden";
		}else if(daytime==1){
			objDivTime.style.visibility="hidden";
			objDivDayTime.style.visibility="visible";
		}else{
			objDivTime.style.visibility="hidden";
			objDivDayTime.style.visibility="hidden";
		}
	}
	function showFeatureDesc(){
		var divFeatureDesc=document.getElementById("featureDesc");
		divFeatureDesc.style.visibility="visible";
	}
	
	function hideFeatureDesc(){
		var divFeatureDesc=document.getElementById("featureDesc");
		divFeatureDesc.style.visibility="hidden";
	}
	
	function showSample(){
		var divSample=document.getElementById("divSample");
		divSample.style.visibility="visible";
	}
	function hideSample(){
		var divSample=document.getElementById("divSample");
		divSample.style.visibility="hidden";
	}
	function showChangeDateTime(daytime){
		var divChngDt=document.getElementById("divChngDt");
		var opt_day=document.getElementById("opt_day");
		var opt_week=document.getElementById("opt_week");
		divChngDt.style.visibility="visible";
		divChngDt.style.position="static";
		if(daytime==0){
			opt_day.checked="checked";
			opt_week.checked="";
		}else{
			opt_day.checked="";
			opt_week.checked="checked";
		}
		showSelectTime(daytime);
	}
	function hideChangeDateTime(){
		var divChngDt=document.getElementById("divChngDt");
		divChngDt.style.visibility="hidden";
		divChngDt.style.position="absolute";
		showSelectTime(2);
	}
	
	function showChangeMinCount(){
		var divChngMinCount=document.getElementById("divMinCount");
		divChngMinCount.style.visibility="visible";
		divChngMinCount.style.position="static";
	}
	function hideChangeMinCount(){
		var divChngMinCount=document.getElementById("divMinCount");
		divChngMinCount.style.visibility="hidden";
		divChngMinCount.style.position="absolute";
	}
	
	function showWhatisthis(event,strWhat){
		var objWhatisthis=document.getElementById("divWhatisthis");
		var ev=(!event)?window.event:event;
		var message="";
		var X='';
		var Y='';
		objWhatisthis.style.visibility="visible";
		if (ev.pageX) {
			X=ev.pageX;
			Y=ev.pageY;
		}else{
			X=event.clientX;
			Y=event.clientY+document.body.scrollTop + document.documentElement.scrollTop;
		}
		if(strWhat=="booktags"){
			message="Tags or Keywords are labels or words that may help users and / or search engines to better identify your book. They are simply short descriptions for a subject. For example, even though your book may be listed under the Business Books category, you may be able to provide additional tags for your book such as Advertising, Branding, Marketing etc.";
		}else if(strWhat=="bookcatrgory"){
			message="You can add your book to list under multiple categories by holding \"Control\" and clicking on more than one category.";
		}else if(strWhat=="storybehindthebook"){
			message="What is the Story Behind Your Book?<br>This could be an interesting anecdote, funny fact or touching secret that helps readers connnect with your work at an emotional level. This story will appear on your fReado profile page and while your book is loading. Keep this less than 1,000 words please :)";
		}else if(strWhat=="pagedisplaysettings"){
			message="The first page of your PDF will always be displayed as the 'cover page' for your book. Therefore if your first page is a blank, your readers will see a blank cover page when they open your book.";
		}else if(strWhat=="mediamentions"){
			message="Please enter links to press-releases, news articles and blogs referencing your book. This helps build interest in your book among would-be readers. These links will be displayed under the Buzz -> Media Mentions tab inside the book. Please provide a brief description of the link in the adjacent field. These fields are optional. While your book will look much nicer with such links to media articles, it is not mandatory. You can always come back and add, delete or edit these links.";
		}else if(strWhat=="videolinks"){
			message="Please enter links to videos on video sharing sites such as YouTube or Metacafe. These videos can be directly related to your book or they can be videos featuring you, the author. These links are optional and you can always come back and add these links.";
		}else if(strWhat=="praiseandreviews"){
			message="Please copy paste praise and endorsements provided to your book by prominent personalities in your field or by the media. This information is optional but very important as it helps build confidence in your book among your readers and gives you credibility. You can always come back and change, delete or update this information. This information is displayed as formatted text under the Buzz button inside BookBuzzr.";
		}else if(strWhat=="authorinterviews"){
			message="Please enter links to interviews that you may have had in the past with prominent newspapers, magazines or blogs. Please provide a brief description of the link in the adjacent field. These fields are optional. While your book will look much nicer with such links to media articles, it is not mandatory. You can always come back and add, delete or edit these links.";
		}else if(strWhat=="buylinks"){
			message="Please enter one or more places from where interested readers can buy your book. The more places you provide for people to buy, the more convenient it becomes for them. Examples can include Amazon, Ebooks.com or Audible.com (please provide the link to your book's product detail page.) Don't forget to provide the price in the description field as people love to comparison shop and get a good deal!";
		}else if(strWhat=="twitterusername"){
			message="So that readers of your book or book-extract can begin following you from within the book itself.";
		}else if(strWhat=="usertags"){
			message="Tags or Keywords are words that may help users and / or search engines to better identify your profile. They are simply short descriptions for the kind of person you are and the field that you choose to write in. For example, you may have written a business book but may choose to add additional keywords to help identify you such as Marketing Expert, Branding Consultant etc.";
		}else if(strWhat=="authortags"){
			message="Tags or Keywords are words that may help users and / or search engines to better identify this author profile. They are simply short descriptions for the kind of person he/she is and the field that he/she chooses to write in. For example, he/she may have written a business book but may choose to add additional keywords to help identify him/her such as Marketing Expert, Branding Consultant etc.";
		}else if(strWhat=="rankingaspertwitter"){
			message="Authors have the option to set up BookBuzzr to send out a tweet when their book is read by a minimum number of readers in a 24 hour period. This list, ranks such books that received the highest number of views yesterday. If an author has not set up his BookBuzzr account to tweet about his or her book then it will not appear on this list.";
		}else if(strWhat=="relatedbooks"){
			message="Your book will be shown along with the books of other authors by default in the last page of book reader. If you choose 'Turn Off Related Books', your book will not be shown up alongside the books of other authors in the book reader. Also, the books of other authors will not show up besides with your book. Most authors DO NOT need to turn off related books. You may want to turn off related books only if you are the author of a children's book and are concerned that inappropriate books may show up alongside your book.";
		}else{
			message=objWhatisthis.innerHTML;
		}
		objWhatisthis.innerHTML=message;
		objWhatisthis.style.top=(Y+2)+"px";
		objWhatisthis.style.left=(X+2)+"px";
	}
	function hideWhatisthis(){
		var objWhatisthis=document.getElementById("divWhatisthis");
		objWhatisthis.style.visibility="hidden";
	}
	
	function showTwitterTips(){
		var objTwitterTips=document.getElementById("divTwitterTips");
		objTwitterTips.style.visibility="visible";
	}
		
	function hideTwitterTips(){
		var objTwitterTips=document.getElementById("divTwitterTips");
		objTwitterTips.style.visibility="hidden";
	}
	
	function showAddMessage(){
		var divAddMessage=document.getElementById("divAddMessage");
		divAddMessage.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var top="";
		var left="";
		left=(myWidth-divAddMessage.style.width.substring(0,(divAddMessage.style.width.length-2)))/2;
		top=(myHeight-divAddMessage.style.height.substring(0,(divAddMessage.style.height.length-2)))/2+document.body.scrollTop;
		top=200+document.body.scrollTop;
		divAddMessage.style.left = left+"px";
		divAddMessage.style.top = top+"px";
	}
	
	function hideAddMessage(contentid,id,page){
		var divAddMessage=document.getElementById("divAddMessage");
		divAddMessage.style.visibility="hidden";
		divAddMessage.style.left = "0px";
		divAddMessage.style.top = "0px";
		var url="";
		if(page==0){
			url=sBaseUrl+"users/settings/bookopentweets.php?contentid="+contentid+"&id="+id;
		}else if(page==1){
			url=sBaseUrl+"users/settings/scheduledTweets.php?contentid="+contentid+"&id="+id;
		}else{
			url=sBaseUrl+"users/settings/milestonetweets.php?contentid="+contentid+"&id="+id;
		}
		window.location=url;
	}
	
	function showMore(item_flag){
		if(item_flag==1){
			var objDivMore=document.getElementById("divWidgetMore");
			var objDivLess=document.getElementById("divWidgetLess");
			var objDiv=document.getElementById("divWidget");
			objDiv.style.height="320px";
		}
		if(item_flag==2){
			var objDivMore=document.getElementById("divSignatureMore");
			var objDivLess=document.getElementById("divSignatureLess");
			var objDiv=document.getElementById("divSignature");
		}
		if(item_flag==3){
			var objDivMore=document.getElementById("divAutoTweetMore");
			var objDivLess=document.getElementById("divAutoTweetLess");
			var objDiv=document.getElementById("divAutoTweet");
		}
		if(item_flag==4){
			var objDivMore=document.getElementById("divInviteFriendsMore");
			var objDivLess=document.getElementById("divInviteFriendsLess");
			var objDiv=document.getElementById("divInviteFriends");
			//var fc = myEditor.get('element').previousSibling,
                //el = myEditor.get('element');
            //Dom.setStyle(fc, 'position', 'static');
            if(pageReload==0){
				load_editor();
				pageReload=1;
			}else{
				var fc = myEditor.get('element').previousSibling,
                el = myEditor.get('element');
            	Dom.setStyle(fc, 'position', 'static');
			}
		}
		if(item_flag==6){
			var objDivMore=document.getElementById("divMiniWidgetMore");
			var objDivLess=document.getElementById("divMiniWidgetLess");
			var objDiv=document.getElementById("divMiniWidget");
		}
		objDivMore.style.visibility="hidden";
		objDivMore.style.position="absolute";
		objDivLess.style.visibility="visible";
		objDivLess.style.position="static";
		objDiv.style.visibility="visible";
		objDiv.style.position="static";
	}
	
	function hideMore(item_flag){
		if(item_flag==1){
			var objDivMore=document.getElementById("divWidgetMore");
			var objDivLess=document.getElementById("divWidgetLess");
			var objDiv=document.getElementById("divWidget");
			objDiv.style.height="0px";
		}
		if(item_flag==2){
			var objDivMore=document.getElementById("divSignatureMore");
			var objDivLess=document.getElementById("divSignatureLess");
			var objDiv=document.getElementById("divSignature");
			hideSignatureUsage();
		}
		if(item_flag==3){
			var objDivMore=document.getElementById("divAutoTweetMore");
			var objDivLess=document.getElementById("divAutoTweetLess");
			var objDiv=document.getElementById("divAutoTweet");
			hideTimezone();
			hideChangeTimezone();
			hideTweetnow();
		}
		if(item_flag==4 || item_flag==5){
			var objDivMore=document.getElementById("divInviteFriendsMore");
			var objDivLess=document.getElementById("divInviteFriendsLess");
			var objDiv=document.getElementById("divInviteFriends");
			if(pageReload==1){
				if(item_flag==4){
					var fc = myEditor.get('element').previousSibling,
		            	el = myEditor.get('element');
		            while(!myEditor){
						var fc = myEditor.get('element').previousSibling,
		            		el = myEditor.get('element');
					}
		        	Dom.setStyle(fc, 'position', 'absolute');
		        	Dom.setStyle(el, 'visibility', 'hidden');
		        	Dom.setStyle(fc, 'top', '-9999px');
	            	Dom.setStyle(fc, 'left', '-9999px');
	            }
            }
		}
		
		if(item_flag==6){
			var objDivMore=document.getElementById("divMiniWidgetMore");
			var objDivLess=document.getElementById("divMiniWidgetLess");
			var objDiv=document.getElementById("divMiniWidget");
		}
		objDivMore.style.visibility="visible";
		objDivMore.style.position="static";
		objDivLess.style.visibility="hidden";
		objDivLess.style.position="absolute";
		objDiv.style.visibility="hidden";
		objDiv.style.top="0px";
		objDiv.style.left="0px";
		objDiv.style.position="absolute";
	}
	
	function showSignatureUsage(){
		var divUsageSignature=document.getElementById("divUsageSignature");
		divUsageSignature.style.visibility="visible";
		if( typeof( window.innerWidth ) == 'number' ) {
	   		//Non-IE
	   		myWidth = window.innerWidth;
	   		myHeight = window.innerHeight;
	 	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   		//IE 6+ in 'standards compliant mode'
	   		myWidth = document.documentElement.clientWidth;
	   		myHeight = document.documentElement.clientHeight;
	 	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	   		//IE 4 compatible
	   		myWidth = document.body.clientWidth;
	   		myHeight = document.body.clientHeight;
	 	}
		var left="";
		var top="";
		left=(myWidth-divUsageSignature.style.width.substring(0,(divUsageSignature.style.width.length-2)))/2;
		top=(myHeight-divUsageSignature.style.height.substring(0,(divUsageSignature.style.height.length-2)))/2+document.body.scrollTop;
		divUsageSignature.style.left = (left)+"px";
		//objhCard.style.top = (top)+"px";
	}
	
	function hideSignatureUsage(){
		var divUsageSignature=document.getElementById("divUsageSignature");
		divUsageSignature.style.visibility="hidden";
		divUsageSignature.style.left="0px";
	}
	
	function showPreviousGroup(curGrpNo,count){
		var curGrpId="divAuthorBooks"+curGrpNo;
		var prevGrpId="divAuthorBooks"+(curGrpNo-count);
		var curGroup=document.getElementById(curGrpId);
		var prevGroup=document.getElementById(prevGrpId);
		curGroup.style.visibility="hidden";
		curGroup.style.position="absolute";
		curGroup.style.top="0px";
		curGroup.style.left="0px";
		prevGroup.style.visibility="visible";
		prevGroup.style.position="static";
	}
	
	function showNextGroup(curGrpNo,count){
		var curGrpId="divAuthorBooks"+curGrpNo;
		var nextGrpId="divAuthorBooks"+(curGrpNo+count);
		var curGroup=document.getElementById(curGrpId);
		var nextGroup=document.getElementById(nextGrpId);
		curGroup.style.visibility="hidden";
		curGroup.style.position="absolute";
		curGroup.style.top="0px";
		curGroup.style.left="0px";
		nextGroup.style.visibility="visible";
		nextGroup.style.position="static";
	}
	
	function getDimension(pageWidth,pageHeight,browserWidth,browserHeight){
		var arrDimension = new Array();
		var pageHeightRatio=0;
		var pageWidthRatio=0;
		var newPageWidth=0;
		var newPageHeight=0;
		browserWidth=(browserWidth/2);
		browserHeight=(browserHeight-20);
		pageHeightRatio=(browserHeight/pageHeight);
		newPageWidth=(pageWidth*pageHeightRatio);
		newPageHeight=(pageHeight*pageHeightRatio);
		if(newPageWidth<=browserWidth && newPageHeight<=browserHeight){
			arrDimension['width']=newPageWidth;
			arrDimension['height']=newPageHeight;
		}else{
			pageWidthRatio=(browserWidth/pageWidth);
			newPageWidth=(pageWidth*pageWidthRatio);
			newPageHeight=(pageHeight*pageWidthRatio);
			arrDimension['width']=newPageWidth;
			arrDimension['height']=newPageHeight;
		}
		return arrDimension;
	}
	
	function checkCategoryCount(){
		var objListBox=document.getElementById('category_id');
		var selectedCount=0;
		for(index=0;index<objListBox.options.length;index++){
			if(objListBox.options[index].selected){
				if(selectedCount>2){
					objListBox.options[index].selected=false;
				}
				selectedCount++;
			}
		}
		if(selectedCount>3){
			alert("Select maximum of three categories");
		}			
	}
	
	function trim(str){
		return str.replace(/^\s+|\s+$/, '');
	}
	
	function isInvalidUrl(url){
		url=trim(url);
		var regExp=/[\`^\s+]/;
		return regExp.test(url);
	}