var rec = [];
var t = new Date();
var recTime = t.valueOf();
var usersavetemparr=new Array();
var tempobjbysave=null;
var topkeywordstr="";
var usersavearray=null;
var usersavegodaddyarray=null;
var godaddycontorl="";
var usersavegodarray=null;
var usersavenamearray=null;
var usersavedeletearray=null;

var sgflagstr=0;
var insertstrvalue="";
var reloaddomainstateflag=0;
var topclicksortname="";
var getdiflag=0;
var settimeoutvar=null;
var rr='';
var compeleteDOmainValueTrueFlag=0;
var opfilStr546124="Please try again.";
var baisesearchstr="";
var sortActNum=7;
var orderActStr="ASC";
$(document).ready(function() {	

	//select all the a tag with name equal to modal
	$('a[name=modal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set height and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight,'left':0});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});

	/*	$('a[name=loginmodal]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set height and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
		$(id).css('background-color',"#FFFFFF");
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});
	*/
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		$('#mask, .window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	


});


var cookies={
       read : function(n){//名字  读cookies
            var dc = "; "+document.cookie+"; ";
            var coo = dc.indexOf("; "+n+"=");
            if (coo!=-1){
                var s = dc.substring(coo+n.length+3,dc.length);
                return unescape(s.substring(0, s.indexOf("; ")));
            }else{
                return "";
            }
        },
        set : function(name,value,expires){//名字 值 过期时间  写cookies
            var expDays = expires*24*60*60*1000;
            var expDate = new Date();
            expDate.setTime(expDate.getTime()+expDays);
            var expString = expires ? "; expires="+expDate.toGMTString() : "";
            var pathString = ";path=/";
            document.cookie = name + "=" + escape(value) + expString + pathString;
        },
        del : function(name){//名字 删除cookies
        value=""
        expires="0"
            var expDays = expires*24*60*60*1000;
            var expDate = new Date();
            expDate.setTime(expDate.getTime()+expDays);
            var expString = expires ? "; expires="+expDate.toGMTString() : "";
            var pathString = ";path=/";
            document.cookie = name + "=" + escape(value) + expString + pathString;
        }
    }; 



var RecaptchaOptions = {
   theme : 'white'
};
var ptq1;
var ptq2;
var ptq3;
var ptq;
var domainEstimateStr="";
var temptldstr="";
var tldstrall="";
var tempkeynumberstr=0;
ptq1=ptq2=ptq3=ptq="";
function ajaxpage(target,url,data,type,tinyLoader,kwNum){
	

	if(url=="getkeywords"){
		if($('#keywords').val().replace(/\s/g,"")==""){
		alert("Please fill in the keywords.");
		return;
		}


	if(new RegExp("[^a-z0-9A-Z]").test($('#keywords').val().replace(/\s/g,""))==true){
	alert("Please fill in the keywords only in letters/numbers.");
	return;
	}

	if(isNaN(parseInt($('#minimumvolume').val()))==true||$('#minimumvolume').val()>1000000000){
	alert("Please fill in a number which is between 0 to 1,000,000,000.");
	return;
	}

	if($("#captchavalidate")!=null && strCheck($("#captchadiv").html())!=false && strCheck($("#captchavalidate").val())==false){
	alert("Please fill in the captcha.");
	return;
	}
	}
	param="";
	if(!type) type="POST";
	for(i=0;i<data.length;i++){
		if(i==0)
			param="v0="+data[i];
		else
			param+="&v"+i+"="+data[i];
	}


if(url=="getkeywords"){
	if($('#numwords').val() == "")
		$('#numwords').val(5);
	param += "&numwords=" + $('#numwords').val();
	param += "&matchType=" + $('#matchType').val();
	param += "&keyword=" + ($('#keywords').val().replace(/\s/g,"_"));
	param += "&token=" + recTime;
}
	if(url!='getdomains'){
		if(tinyLoader)
			$(target).html("");
		else{
			$("#mainLoadBarDiv").attr('style','display:block;position:fixed !important; position:absolute;width:100%;height:100%;top:expression(eval(document.body.scrollTop));left:0px;');
			$("#loadText").html('<B>Processing... Please wait.</B>');
		}
	}
param+="&minimumvolume=" + Math.abs(parseInt($('#minimumvolume').val()));
param+="&sort=" + $('#searchsort').val();

tldstrall="";
var checedflagtemp=0;
$.each($("input[name='tldinput']"),function(i,obj){
if(obj.checked==true){
	if(checedflagtemp==0){
		checedflagtemp=1;
	tldstrall+=obj.value;
	}else{
	tldstrall+="_"+obj.value;
	}
}
});
checedflagtemp=null;

param+="&tldstr=" + tldstrall;

if(url=="getkeywords"){
if(($('#keywords').val().replace(/\s/g,"_"))!=topkeywordstr){//2010-11-15 save temp data
usersavetemparr=null;
usersavetemparr=new Array();
topkeywordstr=($('#keywords').val().replace(/\s/g,"_"));
}

$('#showtendomainby_value').html("");
}
//alert(url);


compeleteDOmainValueTrueFlag=0;
	$.ajax({ url: "home/"+url, context: document.body, data: param+"&captchavalue="+$("#captchavalidate").val(), type: type,  success: function(d){
	getdiflag=0;
		
	//clearTimeout(settimeoutvar);
			$("#mainLoadBarDiv").attr('style','display:none');

			if(d=="ex"){
				//alert("GenericDomainFinder.com is currently undergoing maintenance. Some features will be unavailable at the present time.");
				alert("Please try again.");
				return;
			}

				if(d=="nodata"){
				//alert("GenericDomainFinder.com is currently undergoing maintenance. Some features will be unavailable at the present time.");
				alert("No results found.");
				return;
			}
				
			if(d!="e"){
			//$(target).html(d);
			}

			if(url!='getdomains' && d!='e'){
				$(target).html(d);
				
			}

			if(target=='#results'){
				if(url=="getkeywords"){
					if($('#captchadiv').html().length>1){
						//Recaptcha.reload();//2011-6-1
						}
				}

				
		
				if(d=='e'){
					if($("#captchavalidate")!=null && strCheck($("#captchadiv").html())!=false && strCheck($("#captchavalidate").val())==false){
						
					}else{
						//JSToHomePage();
					//return;
					}

					
					alert("You have entered a wrong captcha phrase, please try again.");
				}else{

					pushGAData_action("gdfbasic");



					if(!kwNum){
						kwNum=1;
					}
				
					$("#keywordsTable").tablesorter();
					$("#keywordsTable2").tablesorter();
					if(url=="admin/searchstat"){
						drawChart();
					}
					else if(url=="getkeywords" || url=="reviewsearch"){
						$('#keywordsTable .gms').each(function(){
							$(this).html(addCommas($(this).html()));
						})
						$('#keywordsTable2 .gms').each(function(){
							$(this).html(addCommas($(this).html()));
						})
						p=1;
						ptq="";
						domainEstimateStr="";
						temptldstr="";
						$('#keywordsTable .kwr').each(function()
						//$('#keywordsTable .kwr').each(function()
						{	/*ptq+=joinKeywords($(this).find(".kwc").html())+'.com,';
							ptq+=joinKeywords($(this).find(".kwc").html())+'.net,';
							ptq+=joinKeywords($(this).find(".kwc").html())+'.org,';
							p++;
							*/
						////////////////////
						temptldstr=$(this).find(".kwc").html();
					$.each($("input[name='tldinput']"),function(i,obj){
						if(obj.checked==true){
				ptq+=joinKeywords(temptldstr)+"."+obj.value+',';
						}
			});
			domainEstimateStr+=temptldstr+",";

					p++;

						});

						
						$('#keywordsTable2 .kwr').each(function()
						//$('#keywordsTable .kwr').each(function()
						{	
							/*ptq+=joinKeywords($(this).find(".kwc").html())+'.com,';
							ptq+=joinKeywords($(this).find(".kwc").html())+'.net,';
							ptq+=joinKeywords($(this).find(".kwc").html())+'.org,';
							*/
							temptldstr=$(this).find(".kwc").html();
		$.each($("input[name='tldinput']"),function(i,obj){
			if(obj.checked==true){
				ptq+=joinKeywords(temptldstr)+"."+obj.value+',';
				}
			});
			domainEstimateStr+=temptldstr+",";
	p++;
						});
							
						if(ptq!=""){
						//ajaxpage('#ptq1','http://www.sencoscrewgun.com/temp/phpsql.php?q=ABC&callback=callback125',[],"GET",1);
						  ptq=ptq.split("&").join("and");
						  ptq=ptq.split("amp;").join("");
						  ptq=ptq.split("?").join("");
						  ptq=ptq.split("=").join("");
						  //$("#mainLoadBarDiv").attr('style','display:block');
						  $("#loadText").html('Getting Domain Availabilities.');
						  rr='';
						  if(url=="reviewsearch"){
							rr='&rr=1';
						  }

						  settimeoutvar=setTimeout(showgetdomainms,10);
										//setTimeout(showgetestimate,10);
						}
					}
				}
			}
		 toshowusersavetemp();
		 },
		  error: function(d){
			ajaxpage(target,url,data,type,tinyLoader,kwNum);
			//$("#mainLoadBarDiv").attr('style','display:none');
			//alert("An error has occured. Please try again.");
		  }
		  });
}
var selectedOptions = []; // Written by: WillyDuitt@hotmail.com \\;
function trimlastchar(txt){
	return txt.substring(0, txt.length-1);
}

function checkAllCB(){
	/*for(i=1;i<=13;i++){
		if($('#cball').attr('checked')){
			$('#keywordsTable td:nth-child('+i+'),th:nth-child('+i+')').show();
			$('#keywordsTable2 td:nth-child('+i+'),th:nth-child('+i+')').show();
			$('#cb'+i).attr('checked','checked');
		}
		else{
			$('#keywordsTable td:nth-child('+i+'),th:nth-child('+i+')').hide();
			$('#keywordsTable2 td:nth-child('+i+'),th:nth-child('+i+')').hide();
			$('#cb'+i).removeAttr('checked');
		}
	}*/
}
function countSelected(select,maxNumber){ 
   for(var i=0; i<select.options.length; i++){
     if(select.options[i].selected && !new RegExp(i,'g').test(selectedOptions.toString())){
        selectedOptions.push(i); 
     }

     if(!select.options[i].selected && new RegExp(i,'g').test(selectedOptions.toString())){
      selectedOptions = selectedOptions.sort(function(a,b){return a-b});  
       for(var j=0; j<selectedOptions.length; j++){ 
         if(selectedOptions[j] == i){
            selectedOptions.splice(j,1);
         }
       } 
     }

     if(selectedOptions.length > maxNumber){
      var throwAlert = true;
        select.options[i].selected = false;
        selectedOptions.pop();
     }  
   }            

     if(throwAlert == true){
        alert('You may only choose '+maxNumber+' options.');
        document.body.focus();
    }
}
function numOnly(evt,maxPage){
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode==13 && $('#pageNumber').val()!="")
		ajaxpage('#results','getkeywords',[1,$('#txt').val(),$('#country').val(),$('#language').val(),$('#matchType').val(),$('#maxRecords').val(),$('#pageNumber').val(),$('#maxPage').val()]);
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}
function joinKeywords(keyword){
	return keyword.split(' ').join('');
}

function addCommas(nStr){
 nStr += '';
 x = nStr.split('.');
 x1 = x[0];
 x2 = x.length > 1 ? '.' + x[1] : '';
 var rgx = /(\d+)(\d{3})/;
 while (rgx.test(x1)) {
  x1 = x1.replace(rgx, '$1' + ',' + '$2');
 }
 return x1 + x2;
}

var deletetepdata="";

function deleteSaveData(){
deletetepdata="";

$.each($("input[name='usercheckbox'][checked]"),function(i,obj){
	if(i!=0){
	deletetepdata+=",";
	}
	deletetepdata+=obj.value;
		
});

if(deletetepdata!=""){
userture=confirm("Are you sure to delete the selected records?");

if(userture){

$.ajax({ url: "home/deleteUserSaveDomianData", context: document.body, data:"deleteid="+deletetepdata+"", type:"POST",  success: function(d){

if(d=="n"){
alert("Please try again.");

}else if(d=="y"){

$.each($('input[name=\'usercheckbox\'][checked]'),function(i,obj){

		if(sgflagstr==0){
				$.each($(usersavearray),function(ind,domainobjtemp2){

			if(domainobjtemp2!=null && domainobjtemp2[0]==obj.value){
			usersavearray.splice(ind,1);
			}

			});
		}else if(sgflagstr==1){
		$.each($(usersavegodaddyarray),function(ind,domainobjtemp2){

			if(domainobjtemp2!=null && domainobjtemp2[0]==obj.value){
			usersavegodaddyarray.splice(ind,1);
			}

			});
		}
		obj.parentNode.parentNode.parentNode.removeChild(obj.parentNode.parentNode);


});
deletetepdata="";

if($("#maxRecords").val()!="" && $("#maxRecords").val()!=null && $("#pageNumber").val()!=null && $("#pageNumber").val()!=""){
//pagemethod($("#maxRecords").val(),$("#pageNumber").val());
}

}else{
alert("Please try again.");

}

},error:function (d){alert("Please try again.");}});



}

}
}

function toshowusersavetemp(){

if(usersavetemparr!=null&&usersavetemparr.length>0){
var tabstr="<div style='height=10px;font-size:18px;padding-top:20px;'>Temporary Saved Domain</div><table width='100%' style='font-size:14px;'><tr height='40px' style='font-size:16px;'><td class='tableTitle' width='310px'><B>Domain</B></td><td class='tableTitle'  width='100px;'><B>Value</B></td><td class='tableTitle'  width='310px'><B>Domain</B></td><td class='tableTitle'  width='100px;'><B>Value</B></td></tr>";
$.each(usersavetemparr,function(i,obj){
	if(i%2==0){
tabstr+="<tr height='25px'><td>"+obj.name+"</td><td>"+obj.value+"</td>";
}else{
tabstr+="<td>"+obj.name+"</td><td>"+obj.value+"</td></tr>";	
	}
});
if((usersavetemparr.length-1)%2==0){
tabstr+="<td></td></tr>";
}
tabstr+="</table>";
//alert(tabstr);
$("#showusersavediv").attr("innerHTML",tabstr);
//alert($("#showusersavediv").attr("innerHTML"));
}
}

function userClickSave(domianStr,domianStatus,cobj){//save user click domian.

if(parseInt(domianStatus)==1){
///alert(cobj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML+"="+((tldstrall.split("_").length)+1));///////////.children[((tldstrall.split("_").length)+1)].innerHTML
//return;

$.ajax({ url: "home/saveUserClickDomain", context: document.body, data:"searchkeyword="+$('#keywords').val()+"&domainName="+domianStr+"&searchval="+cobj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerTEXT+"&cpc="+cobj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML+"&domainvalue="+computeDomainValue(cobj.parentNode.parentNode.parentNode.children[0].innerHTML,cobj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML,cobj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML,$(cobj).attr("title").substring($(cobj).attr("title").indexOf(".")+1,$(cobj).attr("title").length)), type:"POST",  success: function(d){

if(d=="n"){

 if($("#userlogininfo_flname").html()!="null" && $("#userlogininfo_flname").html()!=null && $("#userlogininfo_flname").html()!=""){
	JSToHomePage();
 }else{

alert("Please create an account to save the result for this domain.");
 }
}else if(d=="y"){
/*
$.ajax({ url: "saveUserClickDomainToValue", context: document.body, data:"domainName="+domianStr, type:"POST",  success: function(d){
if(d!=null&&d!=""){
tempobjbysave=d.split(",");
if(tempobjbysave!=null&&tempobjbysave.length==2){
usersavetemparr.push({"name":tempobjbysave[0],"value":tempobjbysave[1]});
}
toshowusersavetemp();
}
},error:function(d){alert("Please try it again.");}});

alert("Result saved to your account, and appraised by Estibot.");
*/
alert("The result has been saved to your account. Please view \"My Saved Domain\".");
}else if(d=="t"){///////////////
	$.ajax({ url: "saveUserClickDomainToValue", context: document.body, data:"domainName="+domianStr, type:"POST",  success: function(d){
if(d!=null&&d!=""){
tempobjbysave=d.split(",");
if(tempobjbysave!=null&&tempobjbysave.length==2){
usersavetemparr.push({"name":tempobjbysave[0],"value":tempobjbysave[1]});
}
toshowusersavetemp();
}
},error:function(d){alert("Please try again.");}});///////////
//alert("Result saved to your account. Free estibot appraisal for 10 domains per day.  Upgrade your account for full access to the search results and unlimited appraisals.");
}else if(d=="f"){

//alert("Free members are limited to 10 free estibot appraisals per day.Please upgrade to a full member for unlimited appraisals.");
}

},error:function (d){alert("Please try again.");}});


}else{
return false;
}


}
var allcheckediflag=1;
function clickeverycheckbox(cobj){

if(cobj.checked==false)
	{
		$('#allcheckbox').attr('checked',false);
		$(cobj).attr('checked',false);
	}else{
	allcheckediflag=1;
	$.each($("input[name='usercheckbox']"),function(i,obj){
	if(obj.checked==false){
	allcheckediflag=0;
	}
	});	
	if(allcheckediflag==1){
	$('#allcheckbox').attr('checked',true);
	}
$(cobj).attr('checked',true);
		}

}

function js_accent_translate(text)
{   var str = text;
//alert(str);
   /* var translated_text = str.replace(/[]/g,'A').replace(/[]/g,'C').replace(/[]/g,'D').replace(/[]/g,'E'
    ).replace(/[]/g,'I').replace(/[]/g,'L').replace(/[]/g,'N').replace(/[]/g,'O').replace(/[]/g,'R'
    ).replace(/[]/g,'S').replace(/[]/g,'T').replace(/[]/g,'U').replace(/[]/g,'Y')
    .replace(/[]/g,'Z').replace(/[]/g,'a').replace(/[]/g,'c').replace(/[]/g,'d')
    .replace(/[]/g,'e').replace(/[]/g,'i').replace(/[]/g,'l').replace(/[]/g,'n')
    .replace(/[]/g,'o').replace(/[]/g,'r').replace(/[]/g,'s').replace(/[]/g,'t')
    .replace(/[]/g,'u').replace(/[]/g,'y').replace(/[]/g,'z');
*/
/*

 var translated_text = str.replace(/[]/g,'A').replace(/[]/g,'C').replace(/[]/g,'D').replace(/[?]/g,'E'
    ).replace(/[]/g,'I').replace(/[?]/g,'L').replace(/[]/g,'N').replace(/[?]/g,'O').replace(/[]/g,'R'
    ).replace(/[/g,'S').replace(/[]/g,'T').replace(/[]/g,'U').replace(/[]/g,'Y')
    .replace(/[甝/g,'Z').replace(/[?]/g,'a').replace(/[]/g,'c').replace(/[]/g,'d')
    .replace(/[?]/g,'e').replace(/[]/g,'i').replace(/[?]/g,'l').replace(/[]/g,'n')
    .replace(/[?]/g,'o').replace(/[]/g,'r').replace(/[]/g,'s').replace(/[]/g,'t')
    .replace(/[]/g,'u').replace(/[]/g,'y').replace(/[]/g,'z');

*/

	//alert(translated_text);
    return translated_text;
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}

function white_space(txt,r)
{	return txt.replace(/\s+/g, r);
}

function drawChart() {
	var data = new google.visualization.DataTable();
	data.addColumn('string', 'Date');
	data.addColumn('number', 'Searches');
	data.addColumn('number', 'Failed Searches');
	vals=$("#vals").html();
	rows=[];
	rows[0]=['',0,0];
		
	if(vals!=""){
		vals=trimlastchar(vals);
		vals = vals.split("|");
		for(i=0;i<vals.length;i++){
			rows[i+1]=vals[i].split(',');
			rows[i+1][1]=parseInt(rows[i+1][1]);
			rows[i+1][2]=parseInt(rows[i+1][2]);
		}
	}
	data.addRows(rows);
	var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
	chart.draw(data, {width: 1100, height: 240, title: 'Daily Searches', 
					  hAxis: {title: 'Year', titleColor:'#FF0000'}
					 });
}

function createshowusersave(selectiflag,everypagenumber,getpagenumber){
var tempaddstr="";
sgflagstr=0;
//usersavearray.sort();
var returnstrvalue="";
if(selectiflag==1){
returnstrvalue+="<br/><div style='font-size:16px;margin-left:15px;margin-bottom:10px;'><a href='javascript:void(0);' style='font-weight:bold;text-decoration: underline;'>GDF Searches</a> | <a onclick=\"godaddycontorl='godaddy';createshowusergodaddysave(1,50,1);\" href='javascript:void(0);' style=''>GoDaddy Expiring</a> | <a onclick=\"godaddycontorl='name';createshowusergodaddysave(1,50,1);\" href='javascript:void(0);' style=''>NameJet PreRelease</a> | <a onclick=\"godaddycontorl='delete';createshowusergodaddysave(1,50,1);\" href='javascript:void(0);' style=''>Pending Delete</a></div><!--<div style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 190px; height: 25px;margin-left:15px;'><div align='center' style='position:relative;top:3px;left:4px;background-color:#FFFFFF;width:95%;height:90%;'><span style='position:relative;top:3px;font-size:14px;'><B>My &nbsp;&nbsp;&nbsp;Saved &nbsp;&nbsp;&nbsp;Domain</B></span> </div></div>--><table><tbody><tr><td style='background: url(&quot;/domain/static/images/leftdiv.jpg&quot;) no-repeat scroll left top transparent; width: 22px;'> </td><td style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 1180px; height: 34px;'><span style='position:relative;top:6px !important;top:11px;'>&nbsp;&nbsp;Total Entries: ";

if(usersavearray!=null&&usersavearray.length>0){
returnstrvalue+=(usersavearray.length);
}else{
returnstrvalue+='0';
}

}else{
returnstrvalue+="<!--<div style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 190px; height: 25px;margin-left:15px;'><div align='center' style='position:relative;top:3px;left:4px;background-color:#FFFFFF;width:95%;height:90%;'><span style='position:relative;top:3px;font-size:14px;'><B>My &nbsp;&nbsp;&nbsp;Saved &nbsp;&nbsp;&nbsp;Domain</B></span></div></div>--><table><tbody><tr><td style='background: url(&quot;/domain/static/images/leftdiv.jpg&quot;) no-repeat scroll left top transparent; width: 22px;'> </td><td  style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 1180px; height: 34px;'>&nbsp;&nbsp;Updatest Saved Domain (Max. 20)";
}

/*
if(usersavearray!=null&&usersavearray.length>0){
returnstrvalue+=(usersavearray.length);
}else{
returnstrvalue+='0';
}
*/
if(selectiflag==1){
returnstrvalue+="</span><div style='padding-top:1px !important;position:relative;top:0px !important;top:-15px;' class='right'>Records per page : <select style='width:50px;position:relative;top:0px !important; top:3px;' id='maxRecords'>";
tempaddstr="<option value=10>10</option><option value=20>20</option><option value=50>50</option><option value=80>80</option><option value=100>100</option>";
tempaddstr=tempaddstr.replace("value="+everypagenumber,"value="+everypagenumber+" selected ");

returnstrvalue+=tempaddstr;

returnstrvalue+="</select>&nbsp;&nbsp;Page : <input type='text' value='"+getpagenumber+"' style='width:30px;position:relative;top:0px !important; top:3px;'  id='pageNumber'> of "+(Math.ceil(usersavearray.length/everypagenumber))+"<input style='left:7px;height:23px;position:relative;top:0px !important; top:3px;' type='button' value='Go!'  onclick='pagemethod($(\"#maxRecords\").val(),$(\"#pageNumber\").val());'>&nbsp;&nbsp;";
if(parseInt(getpagenumber)>1){
returnstrvalue+="<a href='#' onclick='pagemethod($(\"#maxRecords\").val(),"+(parseInt(getpagenumber)-1)+");'>Previous</a>";
}
for(var i=1;i<=(Math.ceil(usersavearray.length/everypagenumber));i++){
returnstrvalue+="&nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords\").val(),"+i+");'>"+i+"</a>";
}
if(parseInt(getpagenumber)<(Math.ceil(usersavearray.length/everypagenumber))){
returnstrvalue+=" &nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords\").val(),"+(parseInt(getpagenumber)+1)+");'>Next</a></div>";
}
}

if(selectiflag==1){
returnstrvalue+="</td><td style='background: url(&quot;/domain/static/images/rightdiv.jpg&quot;) no-repeat scroll left top transparent; width: 35px;'> </td></tr></tbody></table><br/><div style='float:right;margin-right:30px;'><a name='downloada' style='margin-left:20px;' href='myaccount/downloadCsv'><img src='static/images/CSV_download.png' /></a></div><table id='showdatacontent_change_color'   style='margin-top: 15px; margin-left: 20px; margin-right: 20px; font-size: 15px;' width='95%'><tbody><tr height='55px' style='font-size:13px;'><td class='tableTitleToHome' name='domain' width='200' onclick=\"sorthomedata('domain',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\" ><B>Domain</B></td><td  class='tableTitleToHome' name='keyword'  onclick=\"sorthomedata('keyword',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Keywords</B></td><td  class='tableTitleToHome' name='vol'  onclick=\"sorthomedata('vol',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Search Volume</B></td><td  class='tableTitleToHome' name='value'  onclick=\"sorthomedata('value',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Value</B></td><!--<td  class='tableTitleToHome' name='approxcpc'  onclick=\"sorthomedata('approxcpc',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Competition</B></td>--><td  class='tableTitleToHome' name='time'  onclick=\"sorthomedata('time',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Date of Saving</B></td><td width='70' class='tableTitleToHomeDelete' align='center' valign='top'><input style='font-family: tahoma;margin-bottom:8px;position:relative;top:5px;' type='button' value='Delete' onclick='deleteSaveData()'><div style='width: 80px; height: 30px; position: relative; display: inline;'><input id='allcheckbox' type='checkbox' onclick=\"$('input[name=\\'usercheckbox\\']').attr(\'checked\',this.checked);\"/></div></td></tr>";
}else{
returnstrvalue+="</td><td style='background: url(&quot;/domain/static/images/rightdiv.jpg&quot;) no-repeat scroll left top transparent; width: 35px;'> </td></tr></tbody></table><table id='showdatacontent_change_color'  style='margin-top: 15px; margin-left: 20px; margin-right: 20px; font-size: 15px;' width='95%'><tbody><tr height='55px' style='font-size:13px;'><td class='tableTitleToHome' name='domain' width='200' onclick=\"sorthomedata('domain',"+selectiflag+")\" ><B>Domain</B></td><td  class='tableTitleToHome' name='keyword'  onclick=\"sorthomedata('keyword',"+selectiflag+")\"><B>Keywords</B></td><td  class='tableTitleToHome' name='vol'  onclick=\"sorthomedata('vol',"+selectiflag+")\"><B>Search Volume</B></td><td  class='tableTitleToHome' name='value'  onclick=\"sorthomedata('value',"+selectiflag+")\"><B>Value</B></td><!--<td  class='tableTitleToHome' name='approxcpc'  onclick=\"sorthomedata('approxcpc',"+selectiflag+")\"><B>Competition</B></td>--><td  class='tableTitleToHome' name='time'  onclick=\"sorthomedata('time',"+selectiflag+")\"><B>Date of Saving</B></td><td width='70' class='tableTitleToHomeDelete' align='center' valign='top'><input style='font-family: tahoma;margin-bottom:8px;position:relative;top:5px;' type='button' value='Delete' onclick='deleteSaveData()'><div style=' width: 80px; height: 30px; position: relative; display: inline;'><input id='allcheckbox' type='checkbox' onclick=\"$('input[name=\\'usercheckbox\\']').attr(\'checked\',this.checked);\"/></div></td></tr>";
}

if(topclicksortname!=""){

if(topclicksortname.substr(-1,1)=="+"){
returnstrvalue=returnstrvalue.replace("class='tableTitleToHome' name='"+topclicksortname.substr(0,topclicksortname.length-1)+"'","class='tableTitleToHomeToClickdesc'");
}else{
returnstrvalue=returnstrvalue.replace("class='tableTitleToHome' name='"+topclicksortname.substr(0,topclicksortname.length-1)+"'","class='tableTitleToHomeToClickasc'");
}
}

if(selectiflag==1){
$.each(usersavearray,function(i,obj){
if((parseInt(everypagenumber)*parseInt(getpagenumber)-everypagenumber)<=i&&i<((parseInt(everypagenumber)*parseInt(getpagenumber)))){
//alert((parseInt(everypagenumber)*parseInt(getpagenumber))+"="+i+"="+((parseInt(everypagenumber)*parseInt(getpagenumber))+everypagenumber));
returnstrvalue+="<tr style='font-size:10pt;' height='28px' id='showUserSaveTr_"+obj[0]+"'><td style='padding-left:7px;'>"+obj[1]+"</td><td style='padding-left:15px;'>"+obj[4]+"</td><td style='padding-left:15px;'>"+obj[2]+"</td><td style='padding-left:15px;'>"+obj[3]+"</td><!--<td style='padding-left:15px;'>"+checkCpcValue(obj[6])+"</td>--><td style='padding-left:15px;'>"+getTimeFormat(obj[5])+"</td><td align='center'><input name='usercheckbox' onclick='clickeverycheckbox(this)' type='checkbox' value='"+obj[0]+"'/></td></tr>";
}
});
}else{

$.each(usersavearray,function(i,obj){
returnstrvalue+="<tr style='font-size:10pt;' height='28px' id='showUserSaveTr_"+obj[0]+"'><td style='padding-left:7px;'>"+obj[1]+"</td><td style='padding-left:15px;'>"+obj[4]+"</td><td style='padding-left:15px;'>"+obj[2]+"</td><td style='padding-left:15px;'>"+obj[3]+"</td><!--<td style='padding-left:15px;'>"+checkCpcValue(obj[6])+"</td>--><td style='padding-left:15px;'>"+getTimeFormat(obj[5])+"</td><td align='center'><input name='usercheckbox' onclick='clickeverycheckbox(this)' type='checkbox' value='"+obj[0]+"'/></td></tr>";
});
}

returnstrvalue+="</tbody></table><br/><div style='float:right;margin-right:30px;'><a name='downloada' style='margin-left:20px;' href='myaccount/downloadCsv'><img src='static/images/CSV_download.png' /></a></div><br/><br/>";

/////////////
if(selectiflag==1){
returnstrvalue+="<br/><table><tbody><tr><td style='background: url(&quot;/domain/static/images/leftdiv.jpg&quot;) no-repeat scroll left top transparent; width: 22px;'> </td><td style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 1180px; height: 34px;'><span style='position:relative;top:6px !important;top:11px;'>&nbsp;&nbsp;Total Entries: ";

if(usersavearray!=null&&usersavearray.length>0){
returnstrvalue+=(usersavearray.length);
}else{
returnstrvalue+='0';
}

returnstrvalue+="</span><div style='padding-top:1px !important;position:relative;top:0px !important;top:-15px' class='right'>Records per page : <select style='width:50px;position:relative;top:0px !important; top:3px;' id='maxRecords2'>";
tempaddstr="<option value=10>10</option><option value=20>20</option><option value=50>50</option><option value=80>80</option><option value=100>100</option>";
tempaddstr=tempaddstr.replace("value="+everypagenumber,"value="+everypagenumber+" selected ");

returnstrvalue+=tempaddstr;

returnstrvalue+="</select>&nbsp;&nbsp;Page : <input type='text' value='"+getpagenumber+"' style='width:30px;position:relative;top:0px !important; top:3px;'  id='pageNumber2'> of "+(Math.ceil(usersavearray.length/everypagenumber))+"<input style='left:7px;height:23px;position:relative;top:0px !important; top:3px;' type='button' value='Go!'  onclick='pagemethod($(\"#maxRecords2\").val(),$(\"#pageNumber2\").val());'>&nbsp;&nbsp;";
if(parseInt(getpagenumber)>1){
returnstrvalue+="<a href='#' onclick='pagemethod($(\"#maxRecords2\").val(),"+(parseInt(getpagenumber)-1)+");'>Previous</a>";
}
for(var i=1;i<=(Math.ceil(usersavearray.length/everypagenumber));i++){
returnstrvalue+="&nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords2\").val(),"+i+");'>"+i+"</a>";
}
if(parseInt(getpagenumber)<(Math.ceil(usersavearray.length/everypagenumber))){
returnstrvalue+=" &nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords2\").val(),"+(parseInt(getpagenumber)+1)+");'>Next</a></div>";
}

returnstrvalue+="</td><td style='background: url(&quot;/domain/static/images/rightdiv.jpg&quot;) no-repeat scroll left top transparent; width: 35px;'> </td></tr></tbody></table>";
}
//////////////

document.getElementById("showusersavealldata").innerHTML=returnstrvalue;


if($("#showspanid").attr("showvalue")!="1"){
$.each($("a[name='downloada']"),function(i,obj){
			$(obj).attr("style","display:none;");
		});
}

fixTableBackGroundColor();

}

function createshowusergodaddysave(selectiflag,everypagenumber,getpagenumber){
var godaddystylestr="";
var namestylestr="";
var deletestylestr="";
if(godaddycontorl=="godaddy"){
godaddystylestr="font-weight:bold;text-decoration: underline;";
usersavegodaddyarray=usersavegodarray;
}else if(godaddycontorl=="name"){
namestylestr="font-weight:bold;text-decoration: underline;";
usersavegodaddyarray=usersavenamearray;
}else if(godaddycontorl=="delete"){
deletestylestr="font-weight:bold;text-decoration: underline;";
usersavegodaddyarray=usersavedeletearray;
}
//
var tempaddstr="";
sgflagstr=1;
//usersavearray.sort();
var returnstrvalue="<br/><div style='font-size:16px;margin-left:15px;margin-bottom:10px;'><a onclick=\"createshowusersave(1,50,1);\" href='javascript:void(0);' style=''>GDF Searches</a>  | <a onclick=\"godaddycontorl='godaddy';createshowusergodaddysave(1,50,1);\" href='javascript:void(0);' style='"+godaddystylestr+"'>GoDaddy Expiring</a> | <a onclick=\"godaddycontorl='name';createshowusergodaddysave(1,50,1);\" href='javascript:void(0);' style='"+namestylestr+"'>NameJet PreRelease</a> | <a onclick=\"godaddycontorl='delete';createshowusergodaddysave(1,50,1);\" href='javascript:void(0);' style='"+deletestylestr+"'>Pending Delete</a></div>";
if(selectiflag==1){
returnstrvalue+="<!--<div style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 190px; height: 25px;margin-left:15px;'><div align='center' style='position:relative;top:3px;left:4px;background-color:#FFFFFF;width:95%;height:90%;'><span style='position:relative;top:3px;font-size:14px;'><B>My &nbsp;&nbsp;&nbsp;Saved &nbsp;&nbsp;&nbsp;Domain</B></span> </div></div>--><table><tbody><tr><td style='background: url(&quot;/domain/static/images/leftdiv.jpg&quot;) no-repeat scroll left top transparent; width: 22px;'> </td><td style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 1180px; height: 34px;'><span style='position:relative;top:6px !important;top:11px;'>&nbsp;&nbsp;Total Entries: ";

if(usersavegodaddyarray!=null&&usersavegodaddyarray.length>0){
returnstrvalue+=(usersavegodaddyarray.length);
}else{
returnstrvalue+='0';
}

}else{
returnstrvalue+="<!--<div style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 190px; height: 25px;margin-left:15px;'><div align='center' style='position:relative;top:3px;left:4px;background-color:#FFFFFF;width:95%;height:90%;'><span style='position:relative;top:3px;font-size:14px;'><B>My &nbsp;&nbsp;&nbsp;Saved &nbsp;&nbsp;&nbsp;Domain</B></span></div></div>--><table><tbody><tr><td style='background: url(&quot;/domain/static/images/leftdiv.jpg&quot;) no-repeat scroll left top transparent; width: 22px;'> </td><td  style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 1180px; height: 34px;'>&nbsp;&nbsp;Updatest Saved Domain (Max. 20)";
}

/*
if(usersavearray!=null&&usersavearray.length>0){
returnstrvalue+=(usersavearray.length);
}else{
returnstrvalue+='0';
}
*/
if(selectiflag==1){
returnstrvalue+="</span><div style='padding-top:1px !important;position:relative;top:0px !important;top:-15px;' class='right'>Records per page : <select style='width:50px;position:relative;top:0px !important; top:3px;' id='maxRecords'>";
tempaddstr="<option value=10>10</option><option value=20>20</option><option value=50>50</option><option value=80>80</option><option value=100>100</option>";
tempaddstr=tempaddstr.replace("value="+everypagenumber,"value="+everypagenumber+" selected ");

returnstrvalue+=tempaddstr;

returnstrvalue+="</select>&nbsp;&nbsp;Page : <input type='text' value='"+getpagenumber+"' style='width:30px;position:relative;top:0px !important; top:3px;'  id='pageNumber'> of "+(Math.ceil(usersavegodaddyarray.length/everypagenumber))+"<input style='left:7px;height:23px;position:relative;top:0px !important; top:3px;' type='button' value='Go!'  onclick='pagemethod($(\"#maxRecords\").val(),$(\"#pageNumber\").val());'>&nbsp;&nbsp;";
if(parseInt(getpagenumber)>1){
returnstrvalue+="<a href='#' onclick='pagemethod($(\"#maxRecords\").val(),"+(parseInt(getpagenumber)-1)+");'>Previous</a>";
}
for(var i=1;i<=(Math.ceil(usersavegodaddyarray.length/everypagenumber));i++){
returnstrvalue+="&nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords\").val(),"+i+");'>"+i+"</a>";
}
if(parseInt(getpagenumber)<(Math.ceil(usersavegodaddyarray.length/everypagenumber))){
returnstrvalue+=" &nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords\").val(),"+(parseInt(getpagenumber)+1)+");'>Next</a></div>";
}
}

if(selectiflag==1){
returnstrvalue+="</td><td style='background: url(&quot;/domain/static/images/rightdiv.jpg&quot;) no-repeat scroll left top transparent; width: 35px;'> </td></tr></tbody></table><br/><div style='float:left;margin-left:20px;font-size:14px;'>We will send you an alert email the day the domain drops or the listing expires.Click <a href='javascript:void(0);' onclick=\"accountClick('settingaccount_a');$.ajax({ url: 'myaccount/manageaccount', context:$('#showusersavealldata'), data:'', type:'POST',  success: function(d){$('#showusersavealldata').html(d);},error:function (d){alert(opfilStr546124);}});\">here</a> to change that setting.<a name='downloada' style='margin-left:20px;' href='myaccount/downloadCsv'><img style='display:none;' src='static/images/CSV_download.png' /></a></div><table id='showdatacontent_change_color'   style='margin-top: 15px; margin-left: 20px; margin-right: 20px; font-size: 15px;' width='95%'><tbody><tr height='55px' style='font-size:13px;'><td class='tableTitleToHome' name='domain' width='250' onclick=\"sorthomegodaddydata('domain',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\" ><B>Domain</B></td><td  class='tableTitleToHome' name='keyword'  onclick=\"sorthomegodaddydata('keyword',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Keywords</B></td><td  class='tableTitleToHome' name='vol'  onclick=\"sorthomegodaddydata('vol',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Search Volume</B></td><td  class='tableTitleToHome' name='value'  onclick=\"sorthomegodaddydata('value',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Value</B></td><!--<td  class='tableTitleToHome' name='approxcpc'  onclick=\"sorthomegodaddydata('approxcpc',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Competition</B></td><td  class='tableTitleToHome' name='time'  onclick=\"sorthomegodaddydata('time',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Date of Saving</B></td>--><td  class='tableTitleToHome' name='exdt'  onclick=\"sorthomegodaddydata('exdt',"+selectiflag+",$('#maxRecords').val(),$('#pageNumber').val())\"><B>Expire Date</B></td><td width='70' class='tableTitleToHomeDelete' align='center' valign='top'><input style='font-family: tahoma;margin-bottom:8px;position:relative;top:5px;' type='button' value='Delete' onclick='deleteSaveData()'><div style='width: 80px; height: 30px; position: relative; display: inline;'><input id='allcheckbox' type='checkbox' onclick=\"$('input[name=\\'usercheckbox\\']').attr(\'checked\',this.checked);\"/></div></td></tr>";
}else{
returnstrvalue+="</td><td style='background: url(&quot;/domain/static/images/rightdiv.jpg&quot;) no-repeat scroll left top transparent; width: 35px;'> </td></tr></tbody></table><table id='showdatacontent_change_color'  style='margin-top: 15px; margin-left: 20px; margin-right: 20px; font-size: 15px;' width='95%'><tbody><tr height='55px' style='font-size:13px;'><td class='tableTitleToHome' name='domain' width='250' onclick=\"sorthomegodaddydata('domain',"+selectiflag+")\" ><B>Domain</B></td><td  class='tableTitleToHome' name='keyword'  onclick=\"sorthomegodaddydata('keyword',"+selectiflag+")\"><B>Keywords</B></td><td  class='tableTitleToHome' name='vol'  onclick=\"sorthomegodaddydata('vol',"+selectiflag+")\"><B>Search Volume</B></td><td  class='tableTitleToHome' name='value'  onclick=\"sorthomegodaddydata('value',"+selectiflag+")\"><B>Value</B></td><!--<td  class='tableTitleToHome' name='approxcpc'  onclick=\"sorthomegodaddydata('approxcpc',"+selectiflag+")\"><B>Competition</B></td><td  class='tableTitleToHome' name='time'  onclick=\"sorthomegodaddydata('time',"+selectiflag+")\"><B>Date of Saving</B></td>--><td  class='tableTitleToHome' name='exdt'  onclick=\"sorthomegodaddydata('exdt',"+selectiflag+")\"><B>Expire Date</B></td><td width='70' class='tableTitleToHomeDelete' align='center' valign='top'><input style='font-family: tahoma;margin-bottom:8px;position:relative;top:5px;' type='button' value='Delete' onclick='deleteSaveData()'><div style=' width: 80px; height: 30px; position: relative; display: inline;'><input id='allcheckbox' type='checkbox' onclick=\"$('input[name=\\'usercheckbox\\']').attr(\'checked\',this.checked);\"/></div></td></tr>";
}

if(topclicksortname!=""){

if(topclicksortname.substr(-1,1)=="+"){
returnstrvalue=returnstrvalue.replace("class='tableTitleToHome' name='"+topclicksortname.substr(0,topclicksortname.length-1)+"'","class='tableTitleToHomeToClickdesc'");
}else{
returnstrvalue=returnstrvalue.replace("class='tableTitleToHome' name='"+topclicksortname.substr(0,topclicksortname.length-1)+"'","class='tableTitleToHomeToClickasc'");
}
}

if(selectiflag==1){
$.each(usersavegodaddyarray,function(i,obj){
if((parseInt(everypagenumber)*parseInt(getpagenumber)-everypagenumber)<=i&&i<((parseInt(everypagenumber)*parseInt(getpagenumber)))){
//alert((parseInt(everypagenumber)*parseInt(getpagenumber))+"="+i+"="+((parseInt(everypagenumber)*parseInt(getpagenumber))+everypagenumber));
var godaddychangeemailstr="";
if(obj[8]==1){
godaddychangeemailstr="checked=true";
}
////////////////////////////////////////////////////////////////////////////////////////////////////

var godaddyactiontempstr="";

if(godaddycontorl=="godaddy"){
godaddyactiontempstr="<a target='_blank' href='https://auctions.godaddy.com/trpItemListing.aspx?domain="+obj[1]+"'>"+obj[1]+"</a>";

}else if(godaddycontorl=="name"){
godaddyactiontempstr="<a target='_blank' href='http://www.namejet.com/Pages/Auctions/BackorderDetails.aspx?domainname="+obj[1]+"'>"+obj[1]+"</a>";

}else if(godaddycontorl=="delete"){
godaddyactiontempstr="<a target='_blank' href='http://www.namejet.com/Pages/Auctions/BackorderDetails.aspx?domainname="+obj[1]+"'>"+obj[1]+"</a>";

}

returnstrvalue+="<tr style='font-size:10pt;' height='28px' id='showUserSaveTr_"+obj[0]+"'><td style='padding-left:7px;'><input id='"+obj[0]+"' alt='receive email updates' title='receive email updates' type='checkbox' "+godaddychangeemailstr+" onclick=\"godaddyemailchange(this);\"/>"+godaddyactiontempstr+"</td><td style='padding-left:15px;'>"+"<a target='_blank' href='https://www.google.com/search?q="+obj[4]+"'>"+obj[4]+"</a>"+"</td><td style='padding-left:15px;'>"+obj[2]+"</td><td style='padding-left:15px;'>"+obj[3]+"</td><!--<td style='padding-left:15px;'>"+checkCpcValue(obj[6])+"</td><td style='padding-left:15px;'>"+getTimeFormat(obj[5])+"</td>--><td style='padding-left:15px;'>"+getTimeFormatDH(obj[7])+"</td><td align='center'><input name='usercheckbox' onclick='clickeverycheckbox(this)' type='checkbox' value='"+obj[0]+"'/></td></tr>";
godaddychangeemailstr=null;
}
});
}else{

$.each(usersavegodaddyarray,function(i,obj){
returnstrvalue+="<tr style='font-size:10pt;' height='28px' id='showUserSaveTr_"+obj[0]+"'><td style='padding-left:7px;'>"+obj[1]+"</td><td style='padding-left:15px;'>"+obj[4]+"</td><td style='padding-left:15px;'>"+obj[2]+"</td><td style='padding-left:15px;'>"+obj[3]+"</td><!--<td style='padding-left:15px;'>"+checkCpcValue(obj[6])+"</td><td style='padding-left:15px;'>"+getTimeFormat(obj[5])+"</td>--><td style='padding-left:15px;'>"+getTimeFormat(obj[7])+"</td><td align='center'><input name='usercheckbox' onclick='clickeverycheckbox(this)' type='checkbox' value='"+obj[0]+"'/></td></tr>";
});
}

returnstrvalue+="</tbody></table><br/><div style='float:right;margin-right:30px;'><a name='downloada' style='margin-left:20px;' href='myaccount/downloadCsv'><img style='display:none;' src='static/images/CSV_download.png' /></a></div><br/><br/>";

/////////////
if(selectiflag==1){
returnstrvalue+="<br/><table><tbody><tr><td style='background: url(&quot;/domain/static/images/leftdiv.jpg&quot;) no-repeat scroll left top transparent; width: 22px;'> </td><td style='background-image: url(&quot;/domain/static/images/middiv.jpg&quot;); background-repeat: repeat-x; width: 1180px; height: 34px;'><span style='position:relative;top:6px !important;top:11px;'>&nbsp;&nbsp;Total Entries: ";

if(usersavegodaddyarray!=null&&usersavegodaddyarray.length>0){
returnstrvalue+=(usersavegodaddyarray.length);
}else{
returnstrvalue+='0';
}

returnstrvalue+="</span><div style='padding-top:1px !important;position:relative;top:0px !important;top:-15px' class='right'>Records per page : <select style='width:50px;position:relative;top:0px !important; top:3px;' id='maxRecords2'>";
tempaddstr="<option value=10>10</option><option value=20>20</option><option value=50>50</option><option value=80>80</option><option value=100>100</option>";
tempaddstr=tempaddstr.replace("value="+everypagenumber,"value="+everypagenumber+" selected ");

returnstrvalue+=tempaddstr;

returnstrvalue+="</select>&nbsp;&nbsp;Page : <input type='text' value='"+getpagenumber+"' style='width:30px;position:relative;top:0px !important; top:3px;'  id='pageNumber2'> of "+(Math.ceil(usersavegodaddyarray.length/everypagenumber))+"<input style='left:7px;height:23px;position:relative;top:0px !important; top:3px;' type='button' value='Go!'  onclick='pagemethod($(\"#maxRecords2\").val(),$(\"#pageNumber2\").val());'>&nbsp;&nbsp;";
if(parseInt(getpagenumber)>1){
returnstrvalue+="<a href='#' onclick='pagemethod($(\"#maxRecords2\").val(),"+(parseInt(getpagenumber)-1)+");'>Previous</a>";
}
for(var i=1;i<=(Math.ceil(usersavegodaddyarray.length/everypagenumber));i++){
returnstrvalue+="&nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords2\").val(),"+i+");'>"+i+"</a>";
}
if(parseInt(getpagenumber)<(Math.ceil(usersavegodaddyarray.length/everypagenumber))){
returnstrvalue+=" &nbsp;<a href='#' onclick='pagemethod($(\"#maxRecords2\").val(),"+(parseInt(getpagenumber)+1)+");'>Next</a></div>";
}

returnstrvalue+="</td><td style='background: url(&quot;/domain/static/images/rightdiv.jpg&quot;) no-repeat scroll left top transparent; width: 35px;'> </td></tr></tbody></table>";
}
//////////////

document.getElementById("showusersavealldata").innerHTML=returnstrvalue;


if($("#showspanid").attr("showvalue")!="1"){
$.each($("a[name='downloada']"),function(i,obj){
			$(obj).attr("style","display:none;");
		});
}

fixTableBackGroundColor();
var godaddystylestr=null;
var namestylestr=null;
var deletestylestr=null;
}

function godaddyemailchange(cobj){
	if(cobj!=null){
		var gchangenum=cobj.id;
		var stateFlag=0;
		if(cobj.checked==true){
		stateFlag=1;
		}

		$.ajax({ url: "godaddyauctions/changegodaddyemailstate", context: document.body, data:"n="+gchangenum+"&s="+stateFlag, type:"POST",  success: function(d){
			if(d=="n"){
				alert("Please try again.");
				if(cobj.checked==true){
				cobj.checked=false;
				}else{
				cobj.checked=true;
				}
			}else if(d=="y"){
			/*$.each($(usersavegodaddyarray),function(ind,domainobjtemp2){

			if(domainobjtemp2!=null && domainobjtemp2[0]==gchangenum){
			domainobjtemp2[0][8]=stateFlag;
			}

			});*/
			for(var g=0;g<usersavegodaddyarray.length;g++){
				
				if(usersavegodaddyarray[g][0]==gchangenum){
				usersavegodaddyarray[g][8]=stateFlag;
				
				break;
				}
			}
			

			}else{
			alert("Please try again.");
			}
			gchangenum=null;
			stateFlag=null;
			},error:function (d){alert("Please try again.");}});
		
	}

}

function checkCpcValue(cpcstr){
if(cpcstr=="" || cpcstr==null || cpcstr==undefined || undefined=="undefined"){
return "";
}

return cpcstr;

}

function getTimeFormat(timestr){
var return_str_temp="";
if(timestr!="" && timestr!=null){

try{
timestr=timestr.split(" ");
//return_str_temp+=timestr[1]+" ";
timestr=timestr[0].split("-");
return_str_temp+=timestr[1]+"/";
return_str_temp+=timestr[2]+"/";
return_str_temp+=timestr[0];
}catch(err){

}

}

return return_str_temp;
}

function getTimeFormatDH(timestr){
var return_str_temp=timestr;
/*var timefloat=0;
if(timestr!="" && timestr!=null){
var oldtimess=new Date((timestr.split(" "))[0]);
var newtimess=new Date();
		if(oldtimess!=null && newtimess!=null){
		timefloat=(((oldtimess.getTime() - newtimess.getTime() ) / 60)+420);
		var dayint=0;
		var horeint=0;
		var minint=0;
		if(timefloat>0){
			if(timefloat>1440){
			dayint=Math.floor(timefloat/1400);
			timefloat=timefloat-(dayint*1400);
			}
			
			if(timefloat>60){
			horeint=Math.floor(timefloat/60);
			timefloat=timefloat-(horeint*60);
			}
			
			minint=Math.floor(timefloat);

		}
		
		}

if(dayint>0){
 return_str_temp+=dayint+"D ";

 return_str_temp+=horeint+"H";

}else{

return_str_temp+=horeint+"H ";
return_str_temp+=minint+"M";
}

}
*/
return return_str_temp;
}

function sorthomedata(titlestr,seliflag,acctpagenum,acctpage){
if(usersavearray!=null&&usersavearray.length>0){
if(titlestr.indexOf("domain")!=-1){
	if(topclicksortname==(titlestr+"-")){
usersavearray.sort(function (a,b){return a[1].localeCompare(b[1]);});
	//usersavearray.sort(function (a,b){return (a[1]==b[1])?(a[1].localeCompare(b[1])):(a[0].localeCompare(y[0]));});
topclicksortname=titlestr+"+";
	}else {
usersavearray.sort(function (a,b){return b[1].localeCompare(a[1]);});
topclicksortname=titlestr+"-";
				}

}else if(titlestr.indexOf("vol")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavearray.sort(function (a,b){return -(parseInt((""+b[2]).replace(/,/g,""))-parseInt((""+a[2]).replace(/,/g,"")));});
topclicksortname=titlestr+"+";
	}else{
usersavearray.sort(function (a,b){return (parseInt((""+b[2]).replace(/,/g,""))-parseInt((""+a[2]).replace(/,/g,"")));});
topclicksortname=titlestr+"-";
				}

}else if(titlestr.indexOf("value")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavearray.sort(function (a,b){return (parseInt(a[3].substring(1))-parseInt(b[3].substring(1)));});
topclicksortname=titlestr+"+";

	}else{
usersavearray.sort(function (a,b){return (parseInt(b[3].substring(1))-parseInt(a[3].substring(1)));});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("keyword")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavearray.sort(function (a,b){return a[4].localeCompare(b[4]);});
topclicksortname=titlestr+"+";

	}else{
usersavearray.sort(function (a,b){return b[4].localeCompare(a[4]);});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("approxcpc")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavearray.sort(function (a,b){return (parseInt(a[6].substring(1))-parseInt(b[6].substring(1)));});
topclicksortname=titlestr+"+";

	}else{
usersavearray.sort(function (a,b){return (parseInt(b[6].substring(1))-parseInt(a[6].substring(1)));});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("time")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavearray.sort(function (a,b){return a[5].localeCompare(b[5]);});
topclicksortname=titlestr+"+";

	}else{
usersavearray.sort(function (a,b){return b[5].localeCompare(a[5]);});
topclicksortname=titlestr+"-";
}
}

if(seliflag==1){
createshowusersave(seliflag,acctpagenum,acctpage);
}else{
createshowusersave(seliflag);
}
}

}

function sorthomegodaddydata(titlestr,seliflag,acctpagenum,acctpage){
if(usersavegodaddyarray!=null&&usersavegodaddyarray.length>0){
if(titlestr.indexOf("domain")!=-1){
	if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return a[1].localeCompare(b[1]);});
	//usersavearray.sort(function (a,b){return (a[1]==b[1])?(a[1].localeCompare(b[1])):(a[0].localeCompare(y[0]));});
topclicksortname=titlestr+"+";
	}else {
usersavegodaddyarray.sort(function (a,b){return b[1].localeCompare(a[1]);});
topclicksortname=titlestr+"-";
				}

}else if(titlestr.indexOf("vol")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return -(parseInt((""+b[2]).replace(/,/g,""))-parseInt((""+a[2]).replace(/,/g,"")));});
topclicksortname=titlestr+"+";
	}else{
usersavegodaddyarray.sort(function (a,b){return (parseInt((""+b[2]).replace(/,/g,""))-parseInt((""+a[2]).replace(/,/g,"")));});
topclicksortname=titlestr+"-";
				}

}else if(titlestr.indexOf("value")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return (parseInt(a[3].substring(1))-parseInt(b[3].substring(1)));});
topclicksortname=titlestr+"+";

	}else{
usersavegodaddyarray.sort(function (a,b){return (parseInt(b[3].substring(1))-parseInt(a[3].substring(1)));});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("keyword")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return a[4].localeCompare(b[4]);});
topclicksortname=titlestr+"+";

	}else{
usersavegodaddyarray.sort(function (a,b){return b[4].localeCompare(a[4]);});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("approxcpc")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return (parseInt(a[6].substring(1))-parseInt(b[6].substring(1)));});
topclicksortname=titlestr+"+";

	}else{
usersavegodaddyarray.sort(function (a,b){return (parseInt(b[6].substring(1))-parseInt(a[6].substring(1)));});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("time")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return a[5].localeCompare(b[5]);});
topclicksortname=titlestr+"+";

	}else{
usersavegodaddyarray.sort(function (a,b){return b[5].localeCompare(a[5]);});
topclicksortname=titlestr+"-";
}
}else if(titlestr.indexOf("exdt")!=-1){

		if(topclicksortname==(titlestr+"-")){
usersavegodaddyarray.sort(function (a,b){return parseInt(a[7].replace("D","10").replace("H","0").replace("M","").replace(" ",""))-parseInt(b[7].replace("D","10").replace("H","0").replace("M","").replace(" ",""));});
topclicksortname=titlestr+"+";

	}else{
usersavegodaddyarray.sort(function (a,b){return parseInt(b[7].replace("D","10").replace("H","0").replace("M","").replace(" ",""))-parseInt(a[7].replace("D","10").replace("H","0").replace("M","").replace(" ",""));});
topclicksortname=titlestr+"-";
}
}

if(seliflag==1){
createshowusergodaddysave(seliflag,acctpagenum,acctpage);
}else{
createshowusergodaddysave(seliflag);
}
}

}

function pagemethod(nowpagenum,getnowpage){
createshowusersave(1,nowpagenum,getnowpage);

}

function selecttld(oobj){
allcheckediflag=0;



$.each($("input[name='tldinput']"),function(i,obj){
if(obj.checked==true){
allcheckediflag++;
}
});	

if(oobj.checked==true&&allcheckediflag>3){
alert("Please select the domains no more than three at a time.");
oobj.checked=false;
}else if(oobj.checked==false&&allcheckediflag<1){
alert("Please select at least one of the domains.");
oobj.checked=true;
}



$.each($("input[name='tldinput']"),function(i,obj){
if(obj.checked==false){
allcheckediflag=0;
}
});	
}
 
 var estimteArr=null;
 var aposte="";
 var getdiflages=0;

function showgetestimate(){
$.ajax({type:"POST",timeout:30000,async:true,url:'home/showgetestimate',context:null,data:"keywords="+domainEstimateStr.replace(/&/g,"")+"&keytype="+$('#matchType').val(),success:function(res) {
							//alert(234);
							//$.ajaxTimeout(1000); 
							
							if(res==null||res==""){
							 if(getdiflages<10){
								  getdiflages++;
							 showgetestimate();
							  }else{
							  alert('The CPC appraisals of the keywords are not available now,please try it again.');
							  }
							  return false;
							}
							getdiflages=1;
							  $("#mainLoadBarDiv").attr('style','display:none');
							 // resp=res;
							//alert(resp);
							  //resp=resp.slice(resp.indexOf('<p>')+3,resp.indexOf('</p>'));
							  //resp=resp.ltrim();
							  //alert(resp);
							  if(res=='error'){
								 alert('The CPC appraisals of the keywords are not available now,please try it again.');
							  }
							  else{
								  
								


								  //ptq=js_accent_translate(ptq);
								  res=trimlastchar(res.replace(/[^a-zA-Z 0-9,.]+/g,'')).toLowerCase();
								  estimteArr=res.split(',');
								  
								  aposte='';
								var tempjm=0;
								for(j=0;j<estimteArr.length;j++){
									if(j<parseInt($("#l1").html())){
										tempjm=j;
									}
									else{
										tempjm=j-parseInt($("#l1").html());
										aposte='b';
									}
									
									if(estimteArr[j]==0){
									$("#cpc"+(tempjm+1)+aposte).html("0.1");
									}else{
									$("#cpc"+(tempjm+1)+aposte).html(estimteArr[j]);
									}

								  }


								    if(compeleteDOmainValueTrueFlag==1){
								  getTenDomainByValue();
								  }else{
								  compeleteDOmainValueTrueFlag=1;
								  }
							}
						  },error:function(d,s,n){ 
							  if(getdiflages==0){
								  getdiflages=1;
							  showgetestimate();
							  }else{
							  alert('The CPC appraisals of the keywords are not available now,please try it again.');
							  }
						  }});

}


function getTenDomainByValue(){
var tempdomainparm="";
var arraylength=0;
var tendomainvaluearray=new Array();
$.each( $("img[src='static/images/1.png']"), function(i,obj){
if($(obj).attr("title")!=undefined && $(obj).attr("title")!="undefined" && $(obj).attr("title").indexOf("Click")!=-1&&$(obj).attr("title").length>13){
//alert(obj.parentNode.parentNode.parentNode.children[0].innerHTML+'='+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML+'='+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML+'='+$(obj).attr("title").substring($(obj).attr("title").indexOf(".")+1,$(obj).attr("title").length));
tendomainvaluearray.push([$(obj).attr("title").substring(14,$(obj).attr("title").length),computeDomainValue(obj.parentNode.parentNode.parentNode.children[0].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML,$(obj).attr("title").substring($(obj).attr("title").indexOf(".")+1,$(obj).attr("title").length))]);

}
}); 

$.each( $("img[src='http://www.genericdomainfinder.com/static/images/1.png']"), function(i,obj){
if($(obj).attr("title")!=undefined && $(obj).attr("title")!="undefined" && $(obj).attr("title").indexOf("Click")!=-1&&$(obj).attr("title").length>13){
//alert(obj.parentNode.parentNode.parentNode.children[0].innerHTML+'='+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML+'='+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML+'='+$(obj).attr("title").substring($(obj).attr("title").indexOf(".")+1,$(obj).attr("title").length));
tendomainvaluearray.push([$(obj).attr("title").substring(14,$(obj).attr("title").length),computeDomainValue(obj.parentNode.parentNode.parentNode.children[0].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML,$(obj).attr("title").substring($(obj).attr("title").indexOf(".")+1,$(obj).attr("title").length))]);

}
});


tendomainvaluearray=tendomainvaluearray.sort(function (a,b){return (parseInt(b[1])-parseInt(a[1]));} );

if(tendomainvaluearray==null || tendomainvaluearray.length==0){
return;
}


if(tendomainvaluearray.length>=10){
arraylength=10;
}else{
arraylength=tendomainvaluearray.length;
}

tempdomainparm="<table style='font-size:14px;width:100%;'><tr style='background-color:rgb(245, 245, 245);' height=25><td>&nbsp;No.</td><td width=210px>&nbsp;Domain</td><td>&nbsp;Value</td></tr>";
var color_tr_temp="";
for(var t=0;t<arraylength;t++){
	if(t%2!=0){
	color_tr_temp="style='background-color:rgb(245, 245, 245);'";
	}else{
	color_tr_temp="";
	}
tempdomainparm+="<tr height=25 "+color_tr_temp+"><td>&nbsp;"+(t+1)+"</td><td>&nbsp;"+tendomainvaluearray[t][0]+"</td><td>&nbsp;$"+tendomainvaluearray[t][1]+"</td></tr>";
}
tempdomainparm+="</table> <br/> <a href='http://www.genericdomainfinder.com/blog/?p=5' target='_blank' > * Find out how we calculate these values </a> ";
if(($("#Custom_ID_Hidden_ValueTwo").val()+"")!="1"){
tempdomainparm+="<br/><div>Premium accounts cost just $49 per month, and have full access to search results.";

if($("#Custom_ID_Hidden_Value").val()=="" || $("#Custom_ID_Hidden_Value").val()==null){
tempdomainparm+="<a href='signup'><I>Sign up now!</I></a></div>";
}else{
tempdomainparm+="</div><div align='right' style='margin-top:10px;'>"+$("#VNSITNSALSNTS").html()+"</div>";
}

}
$("#showtendomainby_value").html(tempdomainparm);
$("#show_all_login_init").css("display","none");
$("#NDUHESEHDKSDDEWE").css("display","block");
color_tr_temp=null;
tempdomainparm=null;
arraylength=null;
tendomainvaluearray=null;
}


function computeDomainValue(domainkeywordname,searchvalue,cpcstr,suffix){

var tempdomainparm=null;
var suffixfloat=0;
var cpcvalue=0.1;
var domainlengthvalue=0;
var wordnumvalue=0;
var tempStr22="";
var domainvaluetotal=0;
searchvalue=searchvalue.replace(/\,/g,"");
if(strCheck(searchvalue+"")==false){
searchvalue=1;
}

searchvalue=parseInt(searchvalue);

if(strCheck(suffix)!=false){
	suffix=$.trim(suffix.toLowerCase());

	if(suffix=="com"){
	suffixfloat=0.5;
	}else if(suffix=="net" || suffix=="org"){
	suffixfloat=0.05;
	}else if(suffix=="info" || suffix=="biz" || suffix=="us"){
	suffixfloat=0.01;
	}
}

if(strCheck(cpcstr+"")!=false){
	cpcvalue=cpcstr;
}

if(strCheck(domainkeywordname)!=false){
	tempdomainparm=$.trim(domainkeywordname).replace(/-/g," ");
	tempStr22=tempdomainparm.replace(/\s/g,"");
	if(tempStr22.length>=8 && tempStr22.length<=14 ){
	domainlengthvalue=1;
	}else if(tempStr22.length==7){
	domainlengthvalue=1.05;
	}else if(tempStr22.length==6){
	domainlengthvalue=1.1;
	}else if(tempStr22.length==5){
	domainlengthvalue=1.2;
	}else if(tempStr22.length==4){
	domainlengthvalue=1.3;
	}else if(tempStr22.length<=3){
	domainlengthvalue=1.5;
	}else if(tempStr22.length>=15){
	domainlengthvalue=0.98-(tempStr22.length-15)*0.02;
	}

	tempdomainparm=tempdomainparm.split(" ");
	if(tempdomainparm.length==1){
	wordnumvalue=1.2;
	}else if(tempdomainparm.length==2){
	wordnumvalue=1;
	}else if(tempdomainparm.length==3){
	wordnumvalue=0.95;
	}else if(tempdomainparm.length==4){
	wordnumvalue=0.8;
	}else if(tempdomainparm.length>4){
	wordnumvalue=0.1;
	}

}
//alert(searchvalue+"="+cpcvalue+"="+suffixfloat+"="+domainlengthvalue+"="+wordnumvalue);
domainvaluetotal=searchvalue*cpcvalue*suffixfloat*domainlengthvalue*wordnumvalue;

if(domainkeywordname.indexOf("-")!=-1){
domainvaluetotal=domainvaluetotal*0.03;
}

domainvaluetotal=Math.ceil(domainvaluetotal);

tempdomainparm=null;
suffixfloat=null;
cpcvalue=null;
domainlengthvalue=null;
wordnumvalue=null;
tempStr22=null;
domainvaluetotal=domainvaluetotal+"";
if(domainvaluetotal.length==3){
domainvaluetotal=domainvaluetotal.substring(0,2)+"0";
}else if(domainvaluetotal.length>3){
domainvaluetotal=domainvaluetotal.substring(0,(domainvaluetotal.length-2))+"00";
}

return domainvaluetotal;
}


function showgetdomainms(){
	//alert(1);
$.ajax({type:"POST",timeout:30000,async:true,url:'home/getdomainstatus',context:null,data:"doms="+ptq+"&suid="+white_space($('#suid').val()+rr,'|')+"",success:function(res) {
							//alert(234);
							//$.ajaxTimeout(1000); 
							
							if(res==null||res==""){
							 if(getdiflag<10){
								  getdiflag++;
							  showgetdomainms();
							  }else{
							  alert('The domain information is not available now,please try it again.');
							  }
							  return false;
							}
							getdiflag=1;
							  $("#mainLoadBarDiv").attr('style','display:none');
							  resp=res;
							//alert(resp);
							  resp=resp.slice(resp.indexOf('<p>')+3,resp.indexOf('</p>'));
							  //resp=resp.ltrim();
							  //alert(resp);
							  if(resp=='error'){
								 alert('The domain information is not available now,please try it again.');
							  }
							  else{
								  
								  //ptq=js_accent_translate(ptq);
								  resp=trimlastchar(resp.replace(/[^a-zA-Z 0-9,.]+/g,'')).toLowerCase();
								  as=resp.split(',');
								  ptq=trimlastchar(ptq.replace(/[^a-zA-Z 0-9,.]+/g,'')).toLowerCase();
								  ptqs=ptq.split(',');
								  ptqs=ptq.split(',');
								  save=vals="";
								  m1=0;
								  apre=0;
								  apost='';
								
								for(j=0;j<p;j++){
									if(j<parseInt($("#l1").html())){
										jm=j;
									}
									else{
										jm=j-parseInt($("#l1").html());
										apost='b';
									}
									
									temptldstr=tldstrall.split("_");
								
									for(var t=0;t<temptldstr.length;t++){
									tempkeynumberstr=((j*parseInt(temptldstr.length))+t);
								
									if((ptqs[tempkeynumberstr])!=undefined){
										if(as[tempkeynumberstr]==1){
										$("#kwd"+temptldstr[t]+""+(jm+1)+apost).html('<img onmouseout="$(this).attr(\'src\',\'static/images/1.png\');" onmousemove="$(this).attr(\'src\',\'static/images/1m.png\');" style="cursor: pointer;"  onclick="userClickSave(\''+ptqs[tempkeynumberstr]+'\',\''+as[tempkeynumberstr]+'\',this);" title="Click to save '+ptqs[tempkeynumberstr]+'" src="static/images/'+as[tempkeynumberstr]+'.png">');
										}else{
											
											if($("#showtypecb")[0].checked==false){	
											//$("#kwd"+temptldstr[t]+""+(jm+1)+apost).html('ssssssssss');//2010-11-23
											$("#kwd"+temptldstr[t]+""+(jm+1)+apost).html('<img  title="'+ptqs[tempkeynumberstr]+'" src="static/images/'+as[tempkeynumberstr]+'.png">');
											}else{
										////true
										$("#kwd"+temptldstr[t]+""+(jm+1)+apost).html('&nbsp;');
												}
										}
										save+=ptqs[(j*3)+t]+',';
										vals+=as[(j*3)+t]+',';
									}
									

									}
									if(((j>0) && (j%30==0)) || (j==(p-1))){
										/*save=trimlastchar(save);
										vals=trimlastchar(vals);
										ajaxpage('#ptq1','/tq/savedomains',[save,vals],"POST",1);
										save=vals="";
										//2010-11-11 by majie pingbi
										*/
									}
									
								  }
								   // if(compeleteDOmainValueTrueFlag==1){
								  getTenDomainByValue();
								 // }else{
								 // compeleteDOmainValueTrueFlag=1;
								 // }


							}
						  },error:function(d,s,n){ 
							  if(getdiflag==0){
								  getdiflag=1;
							  showgetdomainms();
							  }else{
							  alert('The domain information is not available now,please try it again.');
							  }
						  }});
}

function savealldomain(){
var allDomainStr="";

$.each( $("img[src='static/images/1.png']"), function(i,obj){
if($(obj).attr("title")!=undefined && $(obj).attr("title")!="undefined" && $(obj).attr("title").indexOf("Click")!=-1&&$(obj).attr("title").length>13){
	if(parseInt(i)>1){
	allDomainStr+=":";
	}
allDomainStr+=($(obj).attr("title").substring(14,$(obj).attr("title").length)+"="+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML+"="+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML+"="+computeDomainValue(obj.parentNode.parentNode.parentNode.children[0].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML,$(obj).attr("title").substring($(obj).attr("title").indexOf(".")+1,$(obj).attr("title").length)));

}
}); 

$.each( $("img[src='http://www.genericdomainfinder.com/static/images/1.png']"), function(i,obj){
if($(obj).attr("title")!=undefined && $(obj).attr("title")!="undefined" && $(obj).attr("title").indexOf("Click")!=-1&&$(obj).attr("title").length>13){
	if(parseInt(i)>1){
	allDomainStr+=":";
	}
allDomainStr+=($(obj).attr("title").substring(14,$(obj).attr("title").length)+"="+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML+"="+obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML+"="+computeDomainValue(obj.parentNode.parentNode.parentNode.children[0].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+1)].innerHTML,obj.parentNode.parentNode.parentNode.children[((tldstrall.split("_").length)+2)].firstChild.innerHTML,$(obj).attr("title").substring($(obj).attr("title").indexOf(".")+1,$(obj).attr("title").length)));

}
}); 


if(allDomainStr==""){
return;
}
$.ajax({ url: "home/saveAlldomain", context: document.body, data:"searchkeyword="+$('#keywords').val()+"&domainName="+allDomainStr, type:"POST",  success: function(d){
if(d=="y"){
alert("The results have been saved to your account. Please view \"My Saved Domain\".");
}else if(d=="n"){
JSToHomePage();
}else{
alert("Please try again.");
}

},error:function (d){alert("Please try again.");}});

}

function strCheck(checkstr){
if(checkstr!=null&&checkstr!=""&&checkstr!=undefined&&checkstr!="undefined"){
	if(checkstr.replace(/\s/g,"")!=""){
	return true;
	}else{
	return false;
	}
}else{
return false;
}

}

function getStr(str){
	if(str!=null){
	return str.replace(/\s/g,"");
	}
	return "";
}

function register(){
if(strCheck($("#firstname").val())!=true){
alert("Please fill in the first name.");
return;
}

if(strCheck($("#lastname").val())!=true){
alert("Please fill in the last name.");
return;
}

if(strCheck($("#emailregister").val())!=true){
alert("Please fill in the email address.");
return;
}

if(strCheck($("#password").val())!=true){
alert("Please fill in the password.");
return;
}

if($("#password").val().length<6){
alert("The password should be greater than 6 characters.");
return;
}

if(strCheck($("#password2").val())!=true){
alert("Please confirm the password.");
return;
}

if(strCheck($("#verificationcode").val())!=true){
alert("Please fill in the captcha.");
return;
}

if(checkemail($("#emailregister").val())!=true){
alert("Please fill in an valid email address.");
return;
}

if($("#password").val()!=$("#password2").val()){
alert("Passwords don't match.");
return;
}

if($("#verificationcode")!=null && strCheck($("#verificationcode").val())==false){
	alert("Please fill in the captcha.");
	return;
	}


if(emailexitsflag==1){
toregisterfun();
}else{

	$.ajax({ url: "signup/validatemailexits", context: "", data:"email="+$("#emailregister").val(), type:"POST",  success: function(d){
		if(d=="y"){
		emailexitsflag=1;
		$("#emailexitscontent").html("E-mail: <font color='#3CB371' size='2'>&nbsp;&nbsp;Availabie</font>");
	toregisterfun();

		}else{
			emailexitsflag=0;
	$("#emailexitscontent").html("E-mail: <font color='#B22222' size='2'>&nbsp;&nbsp;Existing</font>");
	//$("#registerbutton").attr("disabled","true");
		//alert("Login fail,please check the E-mail or Password.");
		}

		},error:function (d){$("#emailexitscontent").html("E-mail:");}});



}


}

function toregisterfun(){

$.ajax({ url: "Mailvalidate/validatacaptchacode", context: "", data:"code="+$("#verificationcode").val()+"&email="+$("#emailregister").html(), type:"POST",  success: function(d){
if(d=="y"){
$("#register")[0].submit();
}else{
alert("You have entered a wrong captcha phrase, please try again.");
}

},error:function (d){alert("Please try again.");}});

}

function validateOnLoad(){
if($("#mailcontent")!=null && $("#mailcontent").html()!=""){
	var sendcount=0;
	
do{
$.ajax({ url: "Mailvalidate/sendmail", context: "", data:"reflag=0", type:"POST",  success: function(d){
if(d=="y" || d=="x"){
 sendcount=10;
}
},error:function (d){}});
sendcount++;
}while(sendcount<1);
}
}

function resendemail(){
$.ajax({ url: "Mailvalidate/sendmail", context: "", data:"reflag=1", type:"POST",  success: function(d){
if(d=="y"){
alert("The verification code has been re-sent to your E-mail.");
}else{
alert("Please try again.");
}
},error:function (d){alert("Please try again.");}});

}

function checkemail(str){   
  var   sReg   =   /[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/;
  if(!sReg.test(str)){   
  return   false;   
  }   
    
  return   true;   
}

function emailvalidate(){
if($("#validatecode").val()==""){

alert("Please fill the verification code.");
return;
}else{
$.ajax({ url: "Mailvalidate/validatecode", context: "", data:"code="+$("#validatecode").val()+"&email="+$("#mailcontent").html(), type:"POST",  success: function(d){
if(d=="y"){
alert("The verification is successful. Please log into your account.");
JSToHomePage();
}else if(d=="s"){
alert("The email address has been validated.");
JSToHomePage();
}else{
alert("It fails for the verification. Please check the verification code sent to your E-mail.");
}

},error:function (d){alert("Please try again.");}});
}


}

function userLogin(){
if(strCheck($("#loginemail").val())!=true){
alert("Please fill in the email address.");
return;
}

if(strCheck($("#loginpassword").val())!=true){
alert("Please  fill in the password.");
return;
}

if(checkemail($("#loginemail").val())!=true){
alert("Please enter a valid email address.");
return;
}




$.ajax({ url: "signup/userlogin", context: "", data:"email="+$("#loginemail").val()+"&password="+$("#loginpassword").val(), type:"POST",  success: function(d){
if(d=="y"){
//alert($("#remeberme").val("checked"));
if($("#remeberme")[0].checked==true){
cookies.set("gdf_remeberme","1",30);
cookies.set("gdf_email",$("#loginemail").val(),30);
cookies.set("gdf_password",$("#loginpassword").val(),30);
}else{
cookies.set("gdf_remeberme","0",30);
cookies.set("gdf_email","",30);
cookies.set("gdf_password","",30);
}
cookies.set("gdf_loginout","0",30);
_gaq.push(['_trackEvent', 'Login', 'Success', '1']);

//JSToHomePage();
//window.location.href="http://www.genericdomainfinder.com/Signup/logintohome";
$("#userloginform")[0].submit();


//window.location.href="http://localhost/domain/Signup/logintohome?time="+(new Date()).getTime();

}else if(d=="v"){
alert("The email address hasn't been verified. Please sign up again.");
}else{
alert("Incorrect E-mail or password, please try again.");
}

},error:function (d){alert("Please try again.");}});



}

function JSToHomePage(){
window.location.href="http://www.genericdomainfinder.com/";
//window.location.href="http://localhost/domain/index.php";
}

var emailexitsflag=0;
function validatemailexits(){
		emailexitsflag=0;
	if(checkemail($("#emailregister").val())==true){

		$.ajax({ url: "signup/validatemailexits", context: "", data:"email="+$("#emailregister").val(), type:"POST",  success: function(d){
		if(d=="y"){
		emailexitsflag=1;
		$("#emailexitscontent").html("E-mail: <font color='#3CB371' size='2'>&nbsp;&nbsp;Availabie</font>");
	//$("#registerbutton").removeAttr("disabled");

		}else{
	$("#emailexitscontent").html("E-mail: <font color='#B22222' size='2'>&nbsp;&nbsp;Existing</font>");
	//$("#registerbutton").attr("disabled","true");
		//alert("Login fail,please check the E-mail or Password.");
		}

		},error:function (d){}});



	}else{
	$("#emailexitscontent").html("E-mail:");
	}
}

function sendfeedback(){
	if(strCheck($("#uname").val())!=true){
alert("Please fill in the name.");
return;
}
	if(strCheck($("#email").val())!=true){
alert("Please fill in the email address.");
return;
}

if(strCheck($("#comment").val())!=true){
alert("Please fill in the comment.");
return;
}

if(checkemail($("#email").val())!=true){
alert("Please enter a valid email address.");
return;
}

	if(checkemail($("#email").val())==true){

		$.ajax({ url: "Mailvalidate/sendfeedback", context: "", data:"email="+$("#email").val()+"&name="+$("#uname").val()+"&comment="+$("#comment").val(), type:"POST",  success: function(d){
		if(d=="y"){


		}else{

		}

		},error:function (d){}});



	}

	$("#mask").css("display","none");
	$("#dialog").css("display","none");

}

function getpassword(){

	if(strCheck($("#loginemail").val())!=true){
alert("Please fill in the email address.");
return;
}


if(checkemail($("#loginemail").val())!=true){
alert("Please enter a valid email address.");
return;
}

	if(checkemail($("#loginemail").val())==true){

			$("#mainLoadBarDiv").attr('style','display:block;position:fixed !important; position:absolute;width:100%;height:100%;top:expression(eval(document.body.scrollTop));left:0px;');
			$("#loadText").html('<B>Verifying your email address, please wait.</B>');

		$.ajax({ url: "Mailvalidate/getpassword", context: "", data:"email="+$("#loginemail").val(), type:"POST",  success: function(d){
		if(d=="y"){

alert("The password has been sent to your email address.");
		}else{
alert("Your have entered an invalid email address.");
		}
$("#mainLoadBarDiv").attr('style','display:none;');
		},error:function (d){alert("Please try again.");$("#mainLoadBarDiv").attr('style','display:none;');}});

		

}

	//$("#mask").css("display","none");
	//$("#login").css("display","none");

}


function adminLogin(){
if(strCheck($("#adloginemail").val())!=true){
alert("Please fill in the email address.");
return;
}

if(strCheck($("#adpassword").val())!=true){
alert("Please fill in the password.");
return;
}

if(checkemail($("#adloginemail").val())!=true){
alert("Please enter a valid email address.");
return;
}

$("#adminloginfrom")[0].submit();
}

function chxsClick(cobj,chxinput,chexkallinput){

if(cobj.checked==false)
	{
		$('#'+chexkallinput).attr('checked',false);
		$(cobj).attr('checked',false);
	}else{
	allcheckediflag=1;
	$.each($("input[name='"+chxinput+"']"),function(i,obj){
	if(obj.checked==false){
	allcheckediflag=0;
	}
	});	
	if(allcheckediflag==1){
	$('#'+chexkallinput).attr('checked',true);
	}
	$(cobj).attr('checked',true);
		}

}

function removeFreeData(actionstr){
deletetepdata="";
$.each($("input[name='chxs'][checked]"),function(i,obj){
	if(i!=0){
	deletetepdata+=",";
	}
	deletetepdata+=obj.value;
		
});

if(deletetepdata!=""){
	userture=null;
	if(actionstr=="addfreedata"){
	userture=confirm("Are you sure to grant the selected free records?");
	}else if(actionstr=="removefreedata"){
userture=confirm("Are you sure to remove the selected free records?");
	}
if(userture){

$.ajax({ url: "admin/"+actionstr, context: document.body, data:"deleteid="+deletetepdata+"", type:"POST",  success: function(d){

if(d=="y"){
$.ajax({ url: 'admin/adminsub', context:$('#results'), data:'', type:'POST',  success: function(d){$('#results').html(d);},error:function (d){alert('Please try again.');}});

}else{
alert("Please try again.");
}

},error:function (d){alert("Please try again.");}});



}

}
}

function removeproxyData(actionstr){
deletetepdata="";
$.each($("input[name='chxs'][checked]"),function(i,obj){
	if(i!=0){
	deletetepdata+=",";
	}
	deletetepdata+=obj.value;
		
});

if(deletetepdata!=""){
	userture=null;
	if(actionstr=="useproxies"){
	userture=confirm("Are you sure to use the selected proxies?");
	}else if(actionstr=="cancelproxies"){
userture=confirm("Are you sure to cancel the selected proxies?");
	}else if(actionstr=="deleteproxies"){
	userture=confirm("Are you sure to delete the selected proxies?");
	}
if(userture){

$.ajax({ url: "admin/"+actionstr, context: document.body, data:"deleteid="+deletetepdata+"", type:"POST",  success: function(d){

if(d=="y"){
$.ajax({ url: 'admin/proxy', context:$('#results'), data:'', type:'POST',  success: function(d){$('#results').html(d);},error:function (d){alert('Please try again.');}});

}else{
alert("Please try again.");
}

},error:function (d){alert("Please try again.");}});



}

}
}

function accountClick(nowastr){
$("#mysaveddomain_a").css("background-color","#000000");
$("#auctiondomain_a").css("background-color","#000000");
$("#settingaccount_a").css("background-color","#000000");
$("#robofinder_a").css("background-color","#000000");
$("#"+nowastr).css("background-color","#73B803");

}

function fixTableBackGroundColor(tdlestpar){

$("#showdatacontent_change_color").find("tr").each(function(i,obj){

if(i%2==0){
$(obj).css("background-color","rgb(245, 245, 245)");
}else{
$(obj).css("background-color","#FFFFFF");
}

if(tdlestpar==1){
$(obj).find("td").each(function(x,tdobj){
$(tdobj).css("padding-left","7px");
});
}

});


}


function initimgf(){
$("#initimgcon").html('<img src="static/images/1.png" style="display:none;"><img src="static/images/2.png" style="display:none;"><img src="static/images/0.png" style="display:none;"><img src="static/images/api.png" style="display:none;"><img src="static/images/1m.png" style="display:none;"><img src="static/images/middiv.jpg" style="display:none;"><img src="static/images/leftdiv.jpg" style="display:none;"><img src="static/images/rightdiv.jpg" style="display:none;"><img src="static/images/asc.gif" class="hiddenPic"><img src="static/images/desc.gif" class="hiddenPic"><img src="static/images/ajax-loader3.gif" class="hiddenPic">');
}

function changeImg(contentdiv){
//$.ajax({ url: 'home/refurbishCaptcha', context:$('#'+contentdiv), data:'', type:'POST',  success: function(d){$('#'+contentdiv).html("<img src='"+d+"' />");},error:function (d){alert('Please try again.');}});

$("#regetimagecontentdiv").html("<img width=200 height=80 src='home/captcha?id="+Math.random()+"' />");

}

function pushGAData_action(actionstr){

 if($("#userlogininfo_flname").html()!="null" && $("#userlogininfo_flname").html()!=null && $("#userlogininfo_flname").html()!=""){
 
	 if($("#subscribed_userimg").html()!="null" && $("#subscribed_userimg").html()!=null && $("#subscribed_userimg").html()!=""){
		_gaq.push(['_trackEvent', actionstr, 'search', 'Member', 1]);
	 }else{
		_gaq.push(['_trackEvent', actionstr, 'search', 'Free', 1]);
	 }

 }else{
 _gaq.push(['_trackEvent', actionstr, 'search', 'Outsider', 1]);
 }
}

function getGDFUserState(){

 if($("#userlogininfo_flname").html()!="null" && $("#userlogininfo_flname").html()!=null && $("#userlogininfo_flname").html()!=""){
 
	 if($("#subscribed_userimg")[0]!="null" && $("#subscribed_userimg")[0]!=null && $("#subscribed_userimg")[0]!="undefined" && $("#subscribed_userimg")[0]!=undefined){
		return "m";
	 }else{
		return "f";
	 }

 }else{
 return "o";
 }

}

function getCompetitionStr(competionflo){
var competionReturnStr="";
var competionFloat=0;
try{
competionFloat=parseFloat(competionflo);
}catch(expobj){}

if(competionFloat>=0 && competionFloat<=0.25){
competionReturnStr="low";
}else if(competionFloat>=0.26 && competionFloat<=0.5){
competionReturnStr="medium";
}else if(competionFloat>=0.51 && competionFloat<=0.75){
competionReturnStr="high";
}else if(competionFloat>=0.76 && competionFloat<=1){
competionReturnStr="very high";
}
return competionReturnStr;
}

function loadReDomainState(){
/*
if(window.location.href=="http://www.genericdomainfinder.com/home" || window.location.href=="http://www.genericdomainfinder.com" || window.location.href=="http://www.genericdomainfinder.com/" || window.location.href=="http://www.genericdomainfinder.com/index.php"){
$.ajax({type:"POST",timeout:20000,async:true,url:'home/showgetestimate',context:null,data:"keywords=google&keytype="+$('#matchType').val(),success:function(res) {},error:function(d,s,n){}});
$.ajax({type:"POST",timeout:20000,async:true,url:'home/getdomainstatus',context:null,data:"doms=google.com&suid=1",success:function(res) {},error:function(d,s,n){}});
}
*/
//if(window.location.href=="http://www.genericdomainfinder.com/instant" || window.location.href=="www.genericdomainfinder.com/instant"){
//$.ajax({type:"POST",timeout:20000,async:true,url:'home/showgetestimate',context:null,data:"keywords=google&keytype="+$('#matchType').val(),success:function(res) {},error:function(d,s,n){}});
if(reloaddomainstateflag==0){
$.ajax({type:"POST",timeout:10000,async:true,url:'home/getdomainstatus',context:null,data:"doms=google.com&suid=1",success:function(res) {},error:function(d,s,n){}});
}
reloaddomainstateflag=1;
//}
}

function sortAuctionData(filednum){

if(filednum==sortActNum){
	if(orderActStr=="DESC"){
	orderActStr="ASC";
	}else{
	orderActStr="DESC";
	}
}else{
orderActStr="DESC";
}

sortActNum=filednum;
$('#searchauction')[0].click();

}
