PageSourceSearch

https://www.above.com/js/general.js?1790916611

js above.com collected 2026-10-03 19:47:48 UTC 73,880 bytes, 2,690 lines download raw bytes

1$(document).ready(function() {
2	initHelpTooltip();
3	initPrivacyTooltip();
4});
5
6function initHelpTooltip() {
7	$('.help_tooltip').tooltip({
8		content: function() {
9			return $(this).prop('title');
10		},
11		open: function(event, ui) {
12			if (typeof(event.originalEvent) === 'undefined') {
13				return false;
14			}
15			var $id = $(ui.tooltip).attr('id');
16			$('div.ui-tooltip').not('#' + $id).remove();
17			ui.tooltip.css("max-width", "500px");
18			ui.tooltip.css("z-index", "99999999999");
19		},
20		close: function(event, ui) {
21			ui.tooltip.hover(function() {
22				$(this).stop(true).fadeTo(400, 1);
23			}, function() {
24				$(this).fadeOut('400', function() {
25					$(this).remove();
26				});
27			});
28		}
29	});
30}
31
32function initPrivacyTooltip() {
33	$('.privacy_tooltip').tooltip({
34		content: function() {
35			return $(this).attr('data-title');
36		},
37		items: "a[data-title]",
38		show: 50,
39		hide: 50,
40		open: function(event, ui) {
41			if (typeof(event.originalEvent) === 'undefined') {
42				return false;
43			}
44			var $id = $(ui.tooltip).attr('id');
45			$('div.ui-tooltip').not('#' + $id).remove();
46			ui.tooltip.css("max-width", "400px");
47		},
48		close: function(event, ui) {
49			ui.tooltip.hover(function() {
50				$(this).stop(true).fadeTo(400, 1);
51			}, function() {
52				$(this).fadeOut('400', function() {
53					$(this).remove();
54				});
55			});
56		}
57	});
58	$('.privacy_tooltip').tooltip('close');
59}
60
61function showMenu(comId)
62{
63	x = document.getElementById(comId);
64	chkmouseover(comId);
65	for(i=0;i<document.forms.length;i++)
66	{
67		var theForm = document.forms[0];
68		for(p=0;p<theForm.elements.length;p++)
69		{
70			if(theForm.elements[p].type == 'select-one')
71				theForm.elements[p].style.display = 'none';
72		}
73	}
74	return true;
75}
76
77function hideMenu(comId)
78{
79	x = document.getElementById(comId);
80
81	chkmouseout(comId);
82	for(i=0;i<document.forms.length;i++)
83	{
84		var theForm = document.forms[0];
85		for(p=0;p<theForm.elements.length;p++)
86		{
87			if(theForm.elements[p].type == 'select-one')
88				theForm.elements[p].style.display = '';
89		}
90	}
91	return true;
92}
93
94function chkmouseover(passobj)
95{
96	x = document.getElementById(passobj);
97	curX = findPosX(x);
98	curY = findPosY(x);
99	//alert("curX " + curX);
100	//alert("curY " + curY);
101
102	y = document.getElementById('menu' + passobj);
103
104	y.style.display = '';
105
106	if(passobj == 'catmenu' || passobj == 'supportmenu' || passobj == 'actcatmenu' || passobj == 'actsupportmenu')
107	{
108		if(navigator.appName == 'Microsoft Internet Explorer')
109		{
110			y.style.top = curY + 108;
111			y.style.left = curX - 222;
112		}
113		else
114		{
115			y.style.top = (curY + 1) + "px";
116			y.style.left = (curX - 222) + "px";
117		}
118	}
119	else
120	{
121		if(navigator.appName == 'Microsoft Internet Explorer')
122		{
123			y.style.top = curY + 49;
124			y.style.left = curX - 1;
125		}
126		else
127		{
128			y.style.top = (curY + 49) + "px";
129			y.style.left = (curX + 0) + "px";
130		}
131	}
132	//alert(y.style.top);
133	//alert(y.style.left);
134}
135
136function chkmouseout(passobj)
137{
138	y = document.getElementById('menu' + passobj);
139
140	y.style.display = 'none';
141}
142
143function findPosX(obj)
144{
145	var curleft = 0;
146	if (obj.offsetParent)
147	{
148		while (obj.offsetParent)
149		{
150			curleft += obj.offsetLeft
151			obj = obj.offsetParent;
152		}
153	}
154	else if (obj.x)
155		curleft += obj.x;
156	return curleft;
157}
158
159function findPosY(obj)
160{
161	var curtop = 0;
162	if (obj.offsetParent)
163	{
164		while (obj.offsetParent)
165		{
166			curtop += obj.offsetTop
167			obj = obj.offsetParent;
168		}
169	}
170	else if (obj.y)
171		curtop += obj.y;
172	return curtop;
173}
174
175function screenWidth()
176{
177	if (self.innerWidth)
178	{
179		frameWidth = self.innerWidth;
180		frameHeight = self.innerHeight;
181	}
182	else if (document.documentElement && document.documentElement.clientWidth)
183	{
184		frameWidth = document.documentElement.clientWidth;
185		frameHeight = document.documentElement.clientHeight;
186	}
187	else if (document.body)
188	{
189		frameWidth = document.body.clientWidth;
190		frameHeight = document.body.clientHeight;
191	}
192	return frameWidth;
193}
194
195function screenHeight()
196{
197	if (self.innerWidth)
198	{
199		frameWidth = self.innerWidth;
200		frameHeight = self.innerHeight;
201	}
202	else if (document.documentElement && document.documentElement.clientWidth)
203	{
204		frameWidth = document.documentElement.clientWidth;
205		frameHeight = document.documentElement.clientHeight;
206	}
207	else if (document.body)
208	{
209		frameWidth = document.body.clientWidth;
210		frameHeight = document.body.clientHeight;
211	}
212	return frameHeight;
213}
214
215function noOfRecChanged(frm)
216{
217	//alert(location.protocol + "://" + location.host + location.port + location.port + location.pathname);
218	//var urlstr = location.protocol + "//" + location.host + location.port + location.port + location.pathname;
219	//window.location = urlstr + '?recchange='+comval;
220	frm.submit();
221	return true;
222}
223
224function ChkUncheckBoxes(frm)
225{
226	var passtype = frm.chkAll.checked;
227	var noof = frm.totalrec.value;
228	var comobj;
229	
230	if(passtype == true)
231	comclass = "checked";
232	else
233	comclass = "notchecked";
234	
235	for(i=0;i<noof;i++)
236	{
237		//alert(eval("frm.chk_" + i + ".checked"));
238		eval("frm.chk_" + i + ".checked = " + passtype);
239		x = document.getElementById("tr_" + i);
240		//x.className = comclass;
241	}
242	return true;
243}
244
245function check_uncheck_boxes(frm)
246{
247	var passtype = frm.chkAll.checked;
248	var noof = frm.totalrec.value;
249	var comobj;
250	
251	for(i=0;i<noof;i++)
252	{
253		var x = document.getElementById("chk_domains_" + i);
254		
255		x.checked = passtype;
256	}
257	return true;
258}
259
260function check_uncheck_boxes2(frm)
261{
262    var passtype = frm.chkAll.checked;
263    var noof = frm.total_not_accepted.value;
264    var comobj;
265    
266    for(i=0;i<noof;i++)
267    {
268        var x = document.getElementById("chk_domains_" + i);
269        x.checked = passtype;
270    }
271    return true;
272}
273
274function ChkUncheckIndBoxes()
275{
276	return true;
277}
278
279function passCheckVariables(frm)
280{
281	var chkform = document.frmChange;
282	var noof = chkform.totalrec.value;
283	
284	var tmpcnt = 0;
285	for(i=0;i<noof;i++)
286	{
287		comcheckstatus = eval("chkform.chk_" + i + ".checked");
288		
289		if(comcheckstatus == true)
290		{
291			if(tmpcnt == 0)
292				frm.hidSelectedIDs.value += eval("chkform.chk_" + i + ".value");
293			else
294				frm.hidSelectedIDs.value += "\r\n" + eval("chkform.chk_" + i + ".value");
295			
296			tmpcnt++;
297		}
298	}
299	//alert(frm.hidGivenNames.value);
300	return true;
301}
302
303function trOver(passid)
304{
305	obj = document.getElementById(passid);
306
307	rows = document.getElementById(passid).getElementsByTagName("td");
308	for(i=0;i<rows.length;i++)
309	{
310		tdobj = rows[i];
311		tdobj.style.background='#D2DAFF';
312	}
313	return true;
314}
315
316function trOut(passid)
317{
318	obj = document.getElementById(passid);
319	rows = document.getElementById(passid).getElementsByTagName("td");
320	for(i=0;i<rows.length;i++)
321	{
322		tdobj = rows[i];
323		if(tdobj.className == 'shortTD')
324		tdobj.style.background='#F0F0F0';
325		else
326		tdobj.style.background='';
327	}
328	return true;
329}
330
331function chkmouseover(baseid,newid,selectid)
332{
333	x = document.getElementById(baseid);
334	curX = findPosX(x);
335	curY = findPosY(x);
336
337	
338	//for(i=0;i<document.forms.length;i++)
339	//{
340		//var theForm = document.forms[i];
341		//var theForm = document.frmQuickUpdForm;
342		if(selectid == 'txtIntStatusUpd')
343		{
344		document.getElementById('slLegalUpd').style.display = 'none';
345		document.getElementById('slFlagUpd').style.display = 'none';
346		document.getElementById('slGenericUpd').style.display = 'none';
347		}
348		else if(selectid == 'slGenericUpd')
349		{
350		document.getElementById('slLegalUpd').style.display = 'none';
351		document.getElementById('slFlagUpd').style.display = 'none';
352		}
353		else if(selectid == 'slFlagUpd')
354		{
355		document.getElementById('slLegalUpd').style.display = 'none';
356		}
357		
358		
359	//}
360	//alert("curX " + curX);
361	//alert("curY " + curY);
362	y = document.getElementById(newid);
363	y.style.display = '';
364
365	if(navigator.appName == 'Microsoft Internet Explorer')
366	{
367		y.style.top = curY + 20;
368		y.style.left = curX;
369	}
370	else
371	{
372		y.style.top = (curY) + 20 + "px";
373		y.style.left = (curX) + "px";
374	}
375	return true;
376}
377
378function chSelValue(divid,selectid,selind)
379{
380	var frm = document.frmQuickUpdForm;
381	eval("frm." + selectid + ".options[" + selind + "].selected = true");
382	return showHideSelDiv(divid,selectid);
383}
384
385function showHideSelDiv(divid,selectid)
386{
387	d = document.getElementById(divid);
388	curdis = d.style.display;
389
390	if(curdis == '')
391	{
392		d.style.display = 'none';
393		var theForm = document.frmQuickUpdForm;
394		for(p=0;p<theForm.elements.length;p++)
395		{
396			if(theForm.elements[p].type == 'select-one' && theForm.elements[p].name != selectid)
397				theForm.elements[p].style.display = '';
398		}
399	}
400	else
401	{
402		d.style.display = '';
403		chkmouseover(selectid,divid,selectid);
404	}
405	return true;
406}
407
408function showHideMonthDomainReport(col,totalmonths,noofdomains)
409{
410    var nextval = 'none';
411        a = document.getElementById("chk"+col);
412        if(a.checked == true)
413        {
414            nextval = '';
415        }
416        x = document.getElementById(col);
417        x.style.display = nextval;
418        
419        for(i=1;i<=totalmonths;i++)
420        {
421            y = document.getElementById(col+"1_" + i);
422            y.style.display = nextval;
423        }
424        
425        var totalcells = noofdomains * totalmonths;
426        for(i=1;i<=totalcells;i++)
427        {
428            z = document.getElementById(col+"2_" + i);
429            z.style.display = nextval;
430        }
431    return true;
432}
433
434function showHideAccountCurrency(rowid)
435{
436	x = document.getElementById(rowid);
437	// checking the value of api key field and partner-id field
438	var apikey = document.getElementById("txtSedoApiKey").value;
439	var partnerkey = document.getElementById("txtSedoRegId").value;
440	
441	if (apikey || partnerkey)
442	{
443//		alert('y');
444		x.style.display = '';
445	}
446	else
447	{
448		x.style.display = 'none';
449//		alert('n');
450	}
451	return true;
452}
453
454function clickEventHand(evt)
455{
456	if(navigator.appName == 'Microsoft Internet Explorer')
457	{
458		var comid = evt.srcElement;
459	}
460	else
461	{
462		var comid = evt.target;
463	}
464	//alert(comid.parentNode);
465	var nohidding = 0;
466	//document.getElementById('IconsTable').style.display = 'none';
467	if(comid.parentNode)
468	{
469		x = document.getElementById('IconsTable');
470		if(comid.parentNode != 'javascript:void(0)' && comid.id != 'IconsTable' && x)
471		document.getElementById('IconsTable').style.display = 'none';
472		
473		if(comid.parentNode.id == 'closedivlink')
474		nohidding = 1;
475	}
476	//if(comid.id == 'GenStatusDiv' ||
477	if(!nohidding)
478	{
479		a = document.getElementById('GenStatusDiv');
480		b = document.getElementById('IntStatusDiv');
481		c = document.getElementById('FlagDiv');
482		d = document.getElementById('LegStatusDiv');
483		
484		if(a)
485		document.getElementById('GenStatusDiv').style.display = 'none';
486		if(b)
487		document.getElementById('IntStatusDiv').style.display = 'none';
488		if(c)
489		document.getElementById('FlagDiv').style.display = 'none';
490		if(d)
491		document.getElementById('LegStatusDiv').style.display = 'none';
492		
493		var theForm = document.frmQuickUpdForm;
494		if(theForm)
495		{
496			for(p=0;p<theForm.elements.length;p++)
497			{
498				if(theForm.elements[p].type == 'select-one')
499					theForm.elements[p].style.display = '';
500			}
501		}
502	}
503	//document.getElementById('GenStatusDiv').style.display = 'none';
504	
505	//alert(comid.id + " --- " + comid.parentNode + " --- " + comid.name);
506	/*for(property in comid)
507    {
508         // Show "property" and "type property"
509         nodeName = "IMG"
510         nodeValue = "null";
511         nodeType = 1
512         parentNode = "javascript:void(0)"
513         childNoted = list
514         firs
515         localName = "IMG"
516         tagName
517         id = ""
518         title = ""
519         lang = ""
520         dir = ""
521         className = ""
522         name = ""
523         align = ""
524         alt = ""
525         src
526          alert(property + " --- " + comid[property]);
527     }*/
528	return true;
529}
530
531function sedoUpdate()
532{
533	document.frmChange.submit();
534	return true;
535}
536
537function periodPresetSetNew(frm,curdate,yestdate,last7date,firstdate,lastmonthstart,lastmonthend,last30days,last3mon,last12monstart,last12monend)
538{
539	// NOTE : just add comment for check on live auto refresh javascript
540	s = document.getElementById("period_preset");
541	b = document.getElementById('disdomdemographics');
542    c = document.getElementById("distrafficsource");
543	
544	selindex = parseInt(s.selectedIndex);
545	selperiod = String(eval("frm.period_preset[" + selindex + "].value"));
546	x = document.getElementById("qckSearchUpd");
547	s = document.getElementById('slGroupBy');
548	periodto = curdate;
549    
550    if(b)
551    if(selperiod == 'alltime' || s.value == 'month_service' /*|| s.value == 'month_folder'*/ || s.value == 'compare_report'){
552		// b.style.display = 'none';
553		b.classList.add("disableTdCheckboxclass");
554		$("input[type='checkbox'][name='chkdemographics']").prop('checked', false);
555		$("input[type='checkbox'][name='chkdemographics']").prop('disabled', true);
556		// document.getElementsByName("chkdemographics").disabled = true;   
557    }else{
558		// b.style.display = '';
559		b.classList.remove("disableTdCheckboxclass");
560		// document.getElementsByName("chkdemographics").disabled = false;   
561		$("input[type='checkbox'][name='chkdemographics']").prop('disabled', false);
562    }
563    if(c)
564    if(selperiod == 'alltime' || (s.value != 'month_domain' && s.value != 'domain')){
565		// c.style.display = 'none';
566		c.classList.add("disableTdCheckboxclass");
567		$("input[type='checkbox'][name='chktrafficsource']").prop('checked', false);
568		$("input[type='checkbox'][name='chktrafficsource']").prop('disabled', true);
569		// document.getElementsByName("chktrafficsource").disabled = true;   
570    }else{
571		// c.style.display = '';
572		c.classList.remove("disableTdCheckboxclass");
573		// document.getElementsByName("chktrafficsource").disabled = false;   
574		$("input[type='checkbox'][name='chktrafficsource']").prop('disabled', false);
575    }
576	if(selperiod == 'yesterday')
577	{
578		periodfrom = yestdate;
579		periodto = yestdate;
580		if (s) {
581			if (s.value == 'domain' && x)
582				x.style.display = '';
583		}
584		else if(x){
585			x.style.display = '';
586		}
587	}
588	if(selperiod == 'today')
589	{
590		periodfrom = curdate;
591		if (s) {
592			if (s.value == 'domain' && x)
593				x.style.display = '';
594		}
595		else if(x){
596			x.style.display = '';
597		}
598	}
599	if(selperiod == 'last7days')
600	{
601		periodfrom = last7date;
602		if (s) {
603			if (s.value == 'domain' && x)
604				x.style.display = '';
605		}
606		else if(x){
607			x.style.display = '';
608		}
609	}
610	if(selperiod == 'monthtodate')
611	{
612		periodfrom = firstdate;
613		if (s) {
614			if (s.value == 'domain' && x)
615				x.style.display = '';
616		}
617		else if(x){
618			x.style.display = '';
619		}
620	}
621	if(selperiod == 'lastmonth')
622	{
623		periodfrom = lastmonthstart;
624		periodto = lastmonthend;
625		if (s) {
626			if (s.value == 'domain' && x)
627				x.style.display = '';
628		}
629		else if(x){
630			x.style.display = '';
631		}
632	}
633	if(selperiod == 'last30days')
634	{
635		periodfrom = last30days;
636		if (s) {
637			if (s.value == 'domain' && x)
638				x.style.display = '';
639		}
640		else if(x){
641			x.style.display = '';
642		}
643	}
644	if(selperiod == 'last3months')
645	{
646		periodfrom = last3mon;
647		if (s) {
648			if (s.value == 'domain' && x)
649				x.style.display = '';
650		}
651		else if(x){
652			x.style.display = '';
653		}
654	}
655    if(selperiod == 'last12months')
656    {
657        periodfrom = last12monstart;
658        periodto = last12monend;
659        if (s) {
660            if (s.value == 'domain' && x)
661                x.style.display = '';
662        }
663        else if(x){
664            x.style.display = '';
665        }
666    }
667	if(selperiod == 'alltime')
668	{
669		periodfrom = "";
670		periodto = "";
671		if (s) {
672			if (s.value == 'domain' && x)
673				x.style.display = '';
674		}
675		else if(x){
676			x.style.display = '';
677		}
678	}
679    
680	// AS PER T5893 - IF ELSE
681	g = document.getElementById("serlabel");
682	if(selperiod == 'custom')
683	{
684        periodfrom = frm.view_period_from.value;
685        periodto = frm.view_period_to.value;
686		if (s) {
687			if (s.value == 'domain' && x)
688				x.style.display = 'none';
689		}
690		else if(x){
691			x.style.display = 'none';
692		}
693		if(s.value == 'folder' || s.value == 'day' || s.value == 'month'){
694			g.classList.remove("disableTdCheckboxclass");
695			$("#serlabel input[type='checkbox'],#serlabel input[type='radio']").prop('disabled', false);
696		}
697	}else{
698		if(s.value == 'folder' || s.value == 'day' || s.value == 'month'){
699			g.classList.add("disableTdCheckboxclass");
700			$("#serlabel input[type='checkbox'],#serlabel input[type='radio']").prop('disabled', true);
701			$("#serlabel input[type='checkbox']").prop('checked', false);
702			$("#serlabel input[type='checkbox'][name='chkServices[]'][value='Totals']").prop('checked', true);
703		}
704	}
705//	alert(frm.view_period_from);
706	frm.view_period_from.value = periodfrom;
707	frm.view_period_to.value = periodto;
708	return true;
709}
710
711function periodPresetSet(frm,curdate,yestdate,last7date,firstdate,lastmonthstart,lastmonthend,last30days,last3mon,last12monstart,last12monend)
712{
713	s = document.getElementById("period_preset");
714	b = document.getElementById('disdomdemographics');
715    c = document.getElementById("distrafficsource");
716	
717	selindex = parseInt(s.selectedIndex);
718	selperiod = String(eval("frm.period_preset[" + selindex + "].value"));
719	x = document.getElementById("qckSearchUpd");
720	s = document.getElementById('slGroupBy');
721	periodto = curdate;
722    
723    if(b)
724    if(selperiod == 'alltime' || s.value == 'month_service' || s.value == 'compare_report'){
725		b.style.display = 'none';
726    }else{
727		b.style.display = '';
728    }
729    if(c)
730    if(selperiod == 'alltime' || (s.value != 'month_domain' && s.value != 'domain')){
731		c.style.display = 'none';
732    }else{
733		c.style.display = '';
734    }
735	if(selperiod == 'yesterday')
736	{
737		periodfrom = yestdate;
738		periodto = yestdate;
739		if (s) {
740			if (s.value == 'domain' && x)
741				x.style.display = '';
742		}
743		else if(x){
744			x.style.display = '';
745		}
746	}
747	if(selperiod == 'today')
748	{
749		periodfrom = curdate;
750		if (s) {
751			if (s.value == 'domain' && x)
752				x.style.display = '';
753		}
754		else if(x){
755			x.style.display = '';
756		}
757	}
758	if(selperiod == 'last7days')
759	{
760		periodfrom = last7date;
761		if (s) {
762			if (s.value == 'domain' && x)
763				x.style.display = '';
764		}
765		else if(x){
766			x.style.display = '';
767		}
768	}
769	if(selperiod == 'monthtodate')
770	{
771		periodfrom = firstdate;
772		if (s) {
773			if (s.value == 'domain' && x)
774				x.style.display = '';
775		}
776		else if(x){
777			x.style.display = '';
778		}
779	}
780	if(selperiod == 'lastmonth')
781	{
782		periodfrom = lastmonthstart;
783		periodto = lastmonthend;
784		if (s) {
785			if (s.value == 'domain' && x)
786				x.style.display = '';
787		}
788		else if(x){
789			x.style.display = '';
790		}
791	}
792	if(selperiod == 'last30days')
793	{
794		periodfrom = last30days;
795		if (s) {
796			if (s.value == 'domain' && x)
797				x.style.display = '';
798		}
799		else if(x){
800			x.style.display = '';
801		}
802	}
803	if(selperiod == 'last3months')
804	{
805		periodfrom = last3mon;
806		if (s) {
807			if (s.value == 'domain' && x)
808				x.style.display = '';
809		}
810		else if(x){
811			x.style.display = '';
812		}
813	}
814    if(selperiod == 'last12months')
815    {
816        periodfrom = last12monstart;
817        periodto = last12monend;
818        if (s) {
819            if (s.value == 'domain' && x)
820                x.style.display = '';
821        }
822        else if(x){
823            x.style.display = '';
824        }
825    }
826	if(selperiod == 'alltime')
827	{
828		periodfrom = "";
829		periodto = "";
830		if (s) {
831			if (s.value == 'domain' && x)
832				x.style.display = '';
833		}
834		else if(x){
835			x.style.display = '';
836		}
837	}
838    
839	if(selperiod == 'custom')
840	{
841        periodfrom = frm.view_period_from.value;
842        periodto = frm.view_period_to.value;
843		if (s) {
844			if (s.value == 'domain' && x)
845				x.style.display = 'none';
846		}
847		else if(x){
848			x.style.display = 'none';
849		}
850	}
851//	alert(frm.view_period_from);
852	frm.view_period_from.value = periodfrom;
853	frm.view_period_to.value = periodto;
854	return true;
855}
856
857function periodPresetSetOld(frm,date,month,year)
858{
859	s = document.getElementById("period_preset");
860	//f = document.getElementById(idFrom);
861	//t = document.getElementById(idTo);
862	
863	selindex = parseInt(s.selectedIndex);
864	selval = String(eval("frm.period_preset[" + selindex + "].value"));
865	
866	myDate = new Date();
867	myDate.setFullYear(year,month,date);
868	curfulldate = myDate;
869	
870	curintdate = parseInt(myDate.getDate());
871	curintmonth = parseInt(myDate.getMonth()) + 1;
872	curintyear = parseInt(myDate.getYear()) + 0;
873	
874	var curyear = String(curintyear);
875	if(String(curintdate).length == 1)
876		var curdate = String("0" + curintdate);
877	else
878		var curdate = String(curintdate);
879	
880	if(String(curintmonth).length == 1)
881		var curmonth = String("0" + curintmonth);
882	else
883		var curmonth = String(curintmonth);
884	
885	periodto = curyear + "-" + curmonth + "-" + curdate;
886	//alert(selval);
887	if(selval == 'yesterday')
888	{
889		fromintdate = parseInt(myDate.getDate()) - 1;
890		fromintmonth = parseInt(myDate.getMonth()) + 1;
891		fromintyear = parseInt(myDate.getYear()) + 0;
892		
893		if(s.value == 'domain')
894		x.style.display = '';
895	}
896	if(selval == 'today')
897	{
898		fromintdate = parseInt(myDate.getDate()) + 0;
899		fromintmonth = parseInt(myDate.getMonth()) + 1;
900		fromintyear = parseInt(myDate.getYear()) + 0;
901		if(s.value == 'domain')
902		x.style.display = '';
903	}
904	if(selval == 'last7days')
905	{
906		fromintdate = parseInt(myDate.getDate()) - 6;
907		fromintmonth = parseInt(myDate.getMonth()) + 1;
908		fromintyear = parseInt(myDate.getYear()) + 0;
909		if(s.value == 'domain')
910		x.style.display = '';
911	}
912	if(selval == 'monthtodate')
913	{
914		fromintdate = parseInt(1);
915		fromintmonth = parseInt(myDate.getMonth()) + 1;
916		fromintyear = parseInt(myDate.getYear()) + 0;
917		if(s.value == 'domain')
918		x.style.display = '';
919	}
920	if(selval == 'lastmonth')
921	{
922		fromintdate = parseInt(myDate.getDate()) + 0;
923		fromintmonth = parseInt(myDate.getMonth()) + 0;
924		fromintyear = parseInt(myDate.getYear()) + 0;
925		if(s.value == 'domain')
926		x.style.display = '';
927	}
928	if(selval == 'last30days')
929	{
930		fromintdate = parseInt(myDate.getDate());
931		fromintmonth = parseInt(myDate.getMonth()) + 0;
932		fromintyear = parseInt(myDate.getYear()) + 0;
933		if(s.value == 'domain')
934		x.style.display = '';
935	}
936	if(selval == 'last3months')
937	{
938		fromintdate = parseInt(myDate.getDate()) + 0;
939		fromintmonth = parseInt(myDate.getMonth()) - 2;
940		fromintyear = parseInt(myDate.getYear()) + 0;
941		if(s.value == 'domain')
942		x.style.display = '';
943	}
944	
945	var fromyear = String(fromintyear);
946//	alert(fromintdate);
947	if(String(fromintdate).length == 1)
948		var fromdate = String("0" + fromintdate);
949	else
950		var fromdate = String(fromintdate);
951	
952	if(String(fromintmonth).length == 1)
953		var frommonth = String("0" + fromintmonth);
954	else
955		var frommonth = String(fromintmonth);
956
957	periodfrom = fromyear + "-" + frommonth + "-" + fromdate;
958	
959	if(selval == 'alltime')
960	{
961		periodfrom = "";
962		periodto = "";
963		if(s.value == 'domain')
964		x.style.display = '';
965	}
966	
967	//alert(periodfrom);
968	frm.view_period_from.value = periodfrom;
969	frm.view_period_to.value = periodto;
970	return true;
971}
972
973function periodPresetUnset(idSelect) {
974	
975	s = document.getElementById(idSelect);
976	s.selectedIndex = 0;
977}
978
979/*AS PER T5893 NEW FUNCTION - _new */
980function periodPresetUnset_new(idSelect) {
981	
982	s = document.getElementById(idSelect);
983	s.selectedIndex = 0;
984	$("#"+idSelect).change();
985}
986
987function periodPresetUnset2(idSelect) {
988    
989    s = document.getElementById(idSelect);
990    s.selectedIndex = 0;
991}
992
993function ShowHidFolder(frm)
994{
995	x = document.getElementById('FolderRow');
996	y = frm.chkAddOpt.checked;
997	curstat = x.style.display;
998	if(y == false)
999		x.style.display = 'none';
1000	else
1001		x.style.display = '';
1002	return true;
1003}
1004
1005function ChangeFlagIcon(colid,comind,linkid)
1006{
1007	x = document.getElementById(linkid);
1008	y = document.getElementById("IconsTable");
1009	
1010	curX = findPosX(x);
1011	curY = findPosY(x);
1012	
1013	if(navigator.appName == 'Microsoft Internet Explorer')
1014	{
1015		y.style.top = curY - 110;
1016		y.style.left = curX;
1017	}
1018	else
1019	{
1020		y.style.top = (curY - 110) + "px";
1021		y.style.left = (curX - 0) + "px";
1022	}
1023	y.style.display = '';
1024	var varPre;
1025	
1026	if(colid == 1)
1027		varPre = "slIntStatus_";
1028	else if(colid == 2)
1029		varPre = "slGenStatus_";
1030	else if(colid == 3)
1031		varPre = "slFlag_";
1032	else if(colid == 4)
1033		varPre = "slLegStatus_";
1034
1035	eval("document.frmChange.SelectedFlagId.value = '" + varPre + comind + "'");
1036	eval("document.frmChange.SelectedStatusId.value = '" + colid + "'");
1037	eval("document.frmChange.SelectedFlagInd.value = '" + comind + "'");
1038	
1039//	alert(colid);
1040//	alert(comind);
1041//	alert(linkid);
1042	return true;
1043}
1044
1045function chkReportsSubmit(frm)
1046{
1047	if(typeof frm.txtNames != "undefined" && frm.txtNames.value)
1048	{
1049//		frm.view_period_preset.options[0].selected = true;
1050	}
1051	if( typeof frm.view_period_preset != "undefined" && frm.view_period_preset.value == 'custom') {
1052		if (!isValidDate(frm.view_period_from.value) || !isValidDate(frm.view_period_to.value)) {
1053			alert("Please enter a date in both the From and To boxes, in the format 2012-08-31");
1054			return false;
1055		}
1056	}
1057	return true;
1058}
1059
1060function FlagIconSelected(iconid)
1061{
1062	var selflagid = document.frmChange.SelectedFlagId.value;
1063	var selstatusid = document.frmChange.SelectedStatusId.value;
1064	var selflagind = document.frmChange.SelectedFlagInd.value;
1065	
1066	if(selstatusid == 1)
1067		varPre = "imgIntStatus_";
1068	else if(selstatusid == 2)
1069		varPre = "imgGenStatus_";
1070	else if(selstatusid == 3)
1071		varPre = "imgFlag_";
1072	else if(selstatusid == 4)
1073		varPre = "imgLegStatus_";
1074	
1075	var imgpath = eval("document.frmChange.FlagImgPath_" + iconid + ".value");
1076	eval("document.frmChange." + varPre + selflagind + ".src = '" + imgpath + "'");
1077	eval("document.frmChange." + selflagid + ".value = '" + iconid + "'");
1078	eval("document.frmChange." + selflagid + ".value = '" + iconid + "'");
1079	document.getElementById('IconsTable').style.display = 'none';
1080	return true;
1081}
1082
1083function ContinueRefresh(SesId)
1084{
1085	var curstat = document.frmQuickSearch.ImportStatus.value;
1086	//alert(curstat);
1087	if(curstat == 'f')
1088	{
1089		intervalid = setInterval('CheckImportStatus(\''+ SesId + '\')',3000);
1090	}
1091	else
1092	{
1093		clearInterval(intervalid);
1094		return true;
1095	}
1096}
1097
1098function ContRefCustomReport(GroupBy, SortOn, SortType, CurPage)
1099{
1100//	var curstat = document.frmQuickSearch.ImportStatus.value;
1101	//alert(curstat);
1102//	if(curstat == 'f')
1103//	{
1104//		intervalid = setInterval('ChkCustomReport(\''+ GroupBy + '\', \''+ SortOn+ '\', \''+ SortType+ '\', \''+ CurPage+ '\')',10000);
1105//	}
1106//	else
1107//	{
1108//		clearInterval(intervalid);
1109//		return true;
1110//	}
1111//	ChkCustomReport(\''+ GroupBy + '\', \''+ SortOn+ '\', \''+ SortType+ '\', \''+ CurPage+ '\'
1112}
1113
1114var curstat = 'f';
1115function ContRefCustomStatistics(CurPage, DomCols, StatCols, ListingType, SortOn, SortType)
1116{
1117	var intervalid;
1118	alert(curstat + " first function");
1119	if(curstat == 'f')
1120	{
1121		alert("Colling from first function");
1122		intervalid = setInterval('ChkCustomStatistics(\''+ CurPage + '\', \''+ DomCols+ '\', \''+ StatCols+ '\', \''+ ListingType+ '\', \''+ SortOn+ '\', \''+ SortType+ '\')',20000);
1123	}
1124	else
1125	{
1126		alert("Exiting from first function");
1127		clearInterval(intervalid);
1128		return true;
1129	}
1130}
1131
1132function CheckExportStatus()
1133{
1134	clearInterval();
1135}
1136
1137////////////////////////////////////////////////////////////////////
1138// XML functions and AJAX things
1139////////////////////////////////////////////////////////////////////
1140
1141var xmlHttp;
1142
1143function CheckImportStatus(SesId)
1144{
1145	//	var curstat = document.frmQuickSearch.ImportStatus.value;
1146//	if(curstat == 't')
1147//	{
1148//		ContRefCustomReport(GroupBy, SortOn, SortType, CurPage);
1149//		return true;
1150//	}
1151	
1152	xmlHttp = GetXmlHttpObject();
1153	if(xmlHttp==null)
1154	{
1155		alert("Browser does not support HTTP Request");
1156		return false;
1157	}
1158	var GroupBy = GroupBy;
1159	var SortOn = SortOn;
1160	var SortType = SortType;
1161	var urlPass = "chk_import_status.html";
1162	urlPass = urlPass + "?sid=" + SesId;
1163	urlPass = urlPass + "&randid="+Math.random();
1164//	alert(urlPass);
1165	xmlHttp.onreadystatechange = fillImportMessage;
1166	urlPass = new String(urlPass);
1167	xmlHttp.open("GET",urlPass);
1168	xmlHttp.send(null);
1169	return true;
1170}
1171
1172function CheckBlackDomainsExportStatus(SesId)
1173{
1174	xmlHttp = GetXmlHttpObject();
1175	if(xmlHttp==null)
1176	{
1177		alert("Browser does not support HTTP Request");
1178		return false;
1179	}
1180	var GroupBy = GroupBy;
1181	var SortOn = SortOn;
1182	var SortType = SortType;
1183	var urlPass = "chk_import_status.html";
1184	urlPass = urlPass + "?sid=" + SesId;
1185	urlPass = urlPass + "&randid="+Math.random();
1186//	alert(urlPass);
1187	xmlHttp.onreadystatechange = fillBlackDomainsExportStatus;
1188	urlPass = new String(urlPass);
1189	xmlHttp.open("GET",urlPass);
1190	xmlHttp.send(null);
1191	return true;
1192}
1193
1194var gCurPage = '';
1195var gDomCols = '';
1196var gStatCols = '';
1197var gListingType = '';
1198var gSortOn = '';
1199var gSortType = '';
1200
1201function ChkCustomStatistics(aCurPage, aDomCols, aStatCols, aListingType, aSortOn, aSortType)
1202{
1203//	var curstat = document.frmQuickSearch.ImportStatus.value;
1204//	alert(curstat + " in second function");
1205//	if(curstat == 't')
1206//	{
1207//		alert("Colling from second function");
1208//		ContRefCustomStatistics(CurPage, DomCols, StatCols, ListingType, SortOn, SortType)
1209//		return true;
1210//	}
1211	if(aCurPage)
1212	gCurPage = aCurPage;
1213	if(aDomCols)
1214	gDomCols = aDomCols;
1215	if(aStatCols)
1216	gStatCols = aStatCols;
1217	if(aListingType)
1218	gListingType = aListingType;
1219	if(aSortOn)
1220	gSortOn = aSortOn;
1221	if(aSortType)
1222	gSortType = aSortType;
1223
1224	xmlHttp = GetXmlHttpObject()
1225	if(xmlHttp==null)
1226	{
1227		alert("Browser does not support HTTP Request");
1228		return false;
1229	}
1230	var GroupBy = GroupBy;
1231	var SortOn = SortOn;
1232	var SortType = SortType;
1233	var urlPass = "display_statistics.html";
1234	urlPass = urlPass + "?CurPage=" + gCurPage;
1235	urlPass = urlPass + "&DomCol=" + gDomCols;
1236	urlPass = urlPass + "&StatColumn=" + gStatCols;
1237	urlPass = urlPass + "&ListingType=" + gListingType;
1238	urlPass = urlPass + "&SortType=" + gSortType;
1239	urlPass = urlPass + "&SortOn=" + gSortOn;
1240	urlPass = urlPass + "&randid="+Math.random();
1241//	alert(urlPass);
1242	xmlHttp.onreadystatechange = fillCustomStatistics;
1243	urlPass = new String(urlPass);
1244	xmlHttp.open("GET",urlPass);
1245	xmlHttp.send(null);
1246	return true;
1247}
1248
1249// This is used by add_domains.php, and is related to display_bulkdomadd.php
1250function ChkBulkDomAdd(rcnt)
1251{
1252	xmlHttp = GetXmlHttpObject()
1253	if(xmlHttp==null)
1254	{
1255		alert("Browser does not support HTTP Request");
1256		return false;
1257	}
1258	var GroupBy = GroupBy;
1259	var SortOn = SortOn;
1260	var SortType = SortType;
1261	var urlPass = "display_bulkdomadd.html";
1262	urlPass = urlPass + "?randid="+Math.random();
1263	urlPass = urlPass + "&rcnt="+rcnt;
1264//	alert(urlPass);
1265	xmlHttp.onreadystatechange = fillBulkDomAddition;
1266	urlPass = new String(urlPass);
1267	xmlHttp.open("GET",urlPass);
1268	xmlHttp.send(null);
1269	return true;
1270}
1271
1272function ChkBulkEmailsSending(auto_id)
1273{
1274	$.ajax(
1275			{
1276				url: "display_send_emails.html?id=" + auto_id, 
1277				timeout: 600,
1278				error: function(request,error)
1279				{
1280					if(error=='timeout')
1281					{
1282						alert('time out - couldn\t send emails');
1283					}
1284				},
1285				cache:false,
1286				success:function(msg)
1287				{
1288					x = document.getElementById("send_emails_div");
1289					if (msg == '123') {
1290						window.location = 'send_emails.html';
1291					}
1292					else {
1293						x.innerHTML = msg;
1294					}
1295				}
1296			}
1297		);
1298	return true;
1299}
1300
1301function GetWhoisInformation(page_no, ssid, isad)
1302{
1303	var page_no = page_no;
1304	$.ajax(
1305			{
1306				url: "queue_whois.html?page_no=" + page_no + "&ssi=" + ssid, 
1307				//timeout: 600,
1308				error: function(request,error)
1309				{
1310					//if(error=='timeout')
1311					//{
1312					//	alert('Couldn\'t fetched the whois information');
1313					//}
1314				},
1315				cache:false,
1316				success:function(msg)
1317				{
1318					x = document.getElementById("html_table");
1319					y = document.getElementById("img_box");
1320//					z = document.getElementById("");
1321					x.innerHTML = msg;
1322					
1323					if(isad == 1)
1324					y.innerHTML = '<input type="button" name="but_refresh" value="Fetch Whois" onclick="document.location=\'ownership.html?admf=1\'">';
1325					else
1326					y.innerHTML = '';
1327				}
1328			}
1329		);
1330	return true;
1331}
1332
1333function ChkCustomReportAndStats(JobId)
1334{
1335	xmlHttp = GetXmlHttpObject();
1336	if(xmlHttp==null)
1337	{
1338		alert("Browser does not support HTTP Request");
1339		return false;
1340	}
1341	var urlPass = "display_reports.html";
1342	urlPass = urlPass + "?JobId=" + JobId;
1343	urlPass = urlPass + "&randid="+Math.random();
1344//	alert(urlPass);
1345	xmlHttp.onreadystatechange = fillCustomReportAndStats;
1346	urlPass = new String(urlPass);
1347	xmlHttp.open("GET",urlPass);
1348	xmlHttp.send(null);
1349	return true;
1350}
1351
1352var timerobj;
1353function ChkCustomUserDomainReport(JobId)
1354{
1355    xmlHttp = GetXmlHttpObject();
1356    if(xmlHttp==null)
1357    {
1358        alert("Browser does not support HTTP Request");
1359        return false;
1360    }
1361    var urlPass = "/display_custom_user_domain_report.html";
1362    urlPass = urlPass + "?JobId=" + JobId;
1363    urlPass = urlPass + "&randid="+Math.random();
1364//    alert(urlPass);
1365    
1366    xmlHttp.onreadystatechange = fillCustomUserDomainReport;
1367    urlPass = new String(urlPass);
1368    xmlHttp.open("GET",urlPass);
1369    xmlHttp.send(null);
1370    
1371    timerobj = setTimeout("ChkCustomUserDomainReport( " + JobId + ")",3000);
1372}
1373
1374function ChkBlacklistDomainsExport(JobId)
1375{
1376    xmlHttp = GetXmlHttpObject();
1377    if(xmlHttp==null)
1378    {
1379        alert("Browser does not support HTTP Request");
1380        return false;
1381    }
1382    var urlPass = "display_blacklist_domains_export.html";
1383    urlPass = urlPass + "?JobId=" + JobId;
1384    urlPass = urlPass + "&randid="+Math.random();
1385//    alert(urlPass);
1386    xmlHttp.onreadystatechange = fillCustomReportAndStats;
1387    urlPass = new String(urlPass);
1388    xmlHttp.open("GET",urlPass);
1389    xmlHttp.send(null);
1390    return true;
1391}
1392
1393function ChkCustomRevenueBreakdownReport(JobId)
1394{
1395    xmlHttp = GetXmlHttpObject();
1396    if(xmlHttp==null)
1397    {
1398        alert("Browser does not support HTTP Request");
1399        return false;
1400    }
1401    var urlPass = "display_custom_revenue_breakdown.html";
1402    urlPass = urlPass + "?JobId=" + JobId;
1403    urlPass = urlPass + "&randid="+Math.random();
1404//    alert(urlPass);
1405    xmlHttp.onreadystatechange = fillCustomReportAndStats;
1406    urlPass = new String(urlPass);
1407    xmlHttp.open("GET",urlPass);
1408    xmlHttp.send(null);
1409    return true;
1410}
1411
1412function subEmailForm(frm,optval)
1413{
1414//	alert(frm);
1415	/*.get("test.cgi", { name: "John", time: "2pm" }, 
1416   function(data){ 
1417     alert("Data Loaded: " + data); 
1418   });
1419	*/
1420	$.ajax(
1421			{
1422				url: "get_emails.html?type=" + optval, 
1423				timeout: 40000,
1424				error: function(request,error)
1425				{
1426					if(error=='timeout')
1427					{
1428						alert('time out - couldn\t fetch the result');
1429					}
1430				},
1431				cache:false,
1432				success:function(msg)
1433				{
1434					frm.txt_emails.value = msg;
1435				}
1436			}
1437		);
1438	return true;
1439}
1440
1441function edit_annoucement()
1442{
1443	  var msg_edit = document.getElementById('msg_edit');
1444	   var msg_div = document.getElementById('announcement_msg');
1445	  var msgs = msg_div.innerHTML.replace(/<br>/g,'\n');
1446	  msgs = msgs.replace(/<BR>/g,'\n');
1447      if(!msg_edit) {
1448	     document.getElementById('edit_button').innerHTML = 'Update'
1449	     msg_div.innerHTML = "<textarea id='msg_edit'  rows='10' cols='50'>"+msgs+"</textarea>";
1450	  }
1451	  else {
1452	     update_announcement(msg_edit.value.replace(/\n/g,'<br>'));
1453	     document.getElementById('edit_button').innerHTML = 'Edit';
1454	     msg_div.innerHTML = msg_edit.value.replace(/\n/g,'<br>');
1455	  }
1456   }
1457
1458function swap_announcement_divs(swap_ind)
1459{
1460	x = document.getElementById("sub_buttons");
1461	y = document.getElementById("edit_button");
1462	z = document.getElementById("announcement_msg");
1463	if (swap_ind == 2)
1464	{
1465		y.style.display = '';
1466		x.style.display = 'none';
1467		z.style.display = '';
1468	}
1469	else
1470	{
1471		y.style.display = 'none';
1472		x.style.display = '';
1473		z.style.display = 'none';
1474	}
1475	return true;
1476}
1477
1478function update_announcement(msg)
1479{
1480   	xmlHttp = GetXmlHttpObject()
1481	if(xmlHttp==null)
1482	{
1483		alert("Browser does not support HTTP Request");
1484		return false;
1485	}
1486	var urlPass = "update_announcement.html?dont_render_template=1&a_id=1&msg="+msg;
1487	xmlHttp.onreadystatechange = update_announcement_result;
1488	xmlHttp.open("GET",urlPass);
1489	xmlHttp.send(null);
1490	return true;
1491}
1492
1493function update_announcement_result()
1494{
1495	 
1496	
1497	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
1498	{
1499		if(xmlHttp.responseText == 'f')
1500		{
1501 
1502			 alert('Erro while updating Announcement Content');
1503		}
1504	}
1505}
1506
1507// Called by ChkBulkDomAdd(), from add_domains.php.  
1508function fillBulkDomAddition()
1509{
1510	var comp;
1511	comp = 'f';
1512	
1513	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
1514	{
1515//		alert("complete");
1516		y = document.getElementById('add_domains_div');
1517
1518		var textresponse = xmlHttp.responseText;
1519		var xmlresponse;
1520		var response_status;
1521		try {
1522			xmlresponse = xmlHttp.responseXML.documentElement;
1523			response_status = xmlresponse.getElementsByTagName('status')[0].getAttribute('value'); 
1524		} catch (err) {
1525			xmlresponse = null;
1526			response_status = null;
1527		}
1528		
1529		if (response_status == 'debug')
1530		{
1531			alert("Debug response received from display_bulkdomadd.php");
1532		}
1533		else if (response_status == 'success')
1534		{
1535			var url = xmlresponse.getElementsByTagName('url')[0].getAttribute("value");
1536			window.location = url;
1537		}
1538		else if (response_status == 'retry')
1539		{
1540			var rcnt = xmlresponse.getElementsByTagName('rcnt')[0].getAttribute("value");
1541			ChkBulkDomAdd(rcnt);
1542		}
1543		else if (response_status == 'error')
1544		{
1545			var errmsg = xmlresponse.getElementsByTagName('errmsg')[0].getAttribute("value");
1546			// Ren requirement of displaying no message in case of error
1547//			alert("here");
1548			window.location = 'add_domains.html?red=1';
1549		}
1550		else if (textresponse.indexOf('lock_folder_conf JS') != -1)
1551		{
1552			// Important - the above tag is set in lock_folder_conf.html and must not be removed.
1553			y.innerHTML = textresponse;
1554		}
1555		else
1556		{
1557			// No valid reponse received!  Uh oh.
1558		}
1559		return true;
1560	}
1561}
1562
1563function ChkCustomMaxReport(JobId)
1564{
1565    xmlHttp = GetXmlHttpObject();
1566    if(xmlHttp==null)
1567    {
1568        alert("Browser does not support HTTP Request");
1569        return false;
1570    }
1571    var urlPass = "/admin/display_max_report.html";
1572    urlPass = urlPass + "?JobId=" + JobId;
1573    urlPass = urlPass + "&randid="+Math.random();
1574//    alert(urlPass);
1575    xmlHttp.onreadystatechange = fillCustomReportAndStats;
1576    urlPass = new String(urlPass);
1577    xmlHttp.open("GET",urlPass);
1578    xmlHttp.send(null);
1579    return true;
1580}
1581
1582function fillCustomReportAndStats()
1583{
1584	var comp;
1585	comp = 'f';
1586	
1587	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
1588	{
1589        var reponse = xmlHttp.responseText;
1590		return process_custom_report_reponse(reponse);
1591	}
1592}
1593
1594function fillCustomUserDomainReport()
1595{
1596    var comp;
1597    comp = 'f';
1598    
1599    if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
1600    {
1601        var response = xmlHttp.responseText;
1602        y = document.getElementById('cust_report');
1603        var response_arr = response.split("_");
1604        var job_type = response_arr[0];
1605        var job_id = response_arr[1];
1606        var job_from = response_arr[2];
1607        var header_loc;
1608
1609        // we got a reponse with job type and job it
1610        if(job_id)
1611        {
1612             y.innerHTML = "";
1613             header_loc = "user_domains_stats.html?jobid=" + job_id;
1614             document.location = header_loc;
1615        }
1616        else if(response)
1617        {
1618            y.innerHTML = "<div class='sucmsg2'>" + response + "</div>";
1619        }
1620    }
1621    return true;
1622}
1623
1624function process_custom_report_reponse(response)
1625{
1626    y = document.getElementById('cust_report');
1627    var response_arr = response.split("_");
1628    var job_type = response_arr[0];
1629    var job_id = response_arr[1];
1630	var job_from = response_arr[2];
1631	var reportsHtmlUrlTmp = document.referrer.split('?')[0];
1632	var pieces = reportsHtmlUrlTmp.split(/[\s/]+/);
1633	// for getting reports.html or reports_new.html from url
1634	// # AS PER T6529 - old = reports_old , new  = reports ( reports_new.html logic )
1635	var reportsHtmlUrl = pieces[pieces.length-1];
1636	if(reportsHtmlUrl!='reports_old.html'){
1637		reportsHtmlUrl = 'reports.html';
1638	}
1639    var header_loc;
1640    // alert(job_type + ":" + job_id + ":" + job_from);
1641    // we got a reponse with job type and job it
1642    if(job_id)
1643    {
1644        if(job_type == 'CR')
1645        {
1646            y.innerHTML = "<div class='sucmsg2'>You are being redirected... Please wait...</div>";
1647            header_loc = reportsHtmlUrl+"?jobid=" + job_id;
1648        }
1649        else if(job_type == 'CS' && job_from == 't')
1650        {
1651            y.innerHTML = "<div class='sucmsg2'>You are being redirected... Please wait...</div>";
1652            header_loc = reportsHtmlUrl+"?reportstats=1&jobid=" + job_id;
1653        }
1654        else if(job_type == 'CS')
1655        {
1656            y.innerHTML = "<div class='sucmsg2'>You are being redirected... Please wait...</div>";
1657            header_loc = "statistics.html?jobid=" + job_id;
1658        }
1659        else if(job_type == 'AR')
1660        {
1661            y.innerHTML = "<div class='sucmsg2'>You are being redirected... Please wait...</div>";
1662            header_loc = reportsHtmlUrl+"?jobid=" + job_id;
1663        }
1664        else if(job_type == 'ES')
1665        {
1666            y.innerHTML = "";
1667            header_loc = "tasks.html?jobid=" + job_id + "&download=1";
1668        }
1669        else if(job_type == 'ER')
1670        {
1671            y.innerHTML = "";
1672            header_loc = "tasks.html?jobid=" + job_id + "&download=1";
1673        }
1674        else if(job_type == 'EER')
1675        {
1676            y.innerHTML = "";
1677            header_loc = "/admin/error_reporting.html?jobid=" + job_id + "&download=1";
1678        }
1679        else if(job_type == 'DH')
1680        {
1681            y.innerHTML = "";
1682            header_loc = "domain_history.html?jobid=" + job_id;
1683        }
1684        else if(job_type == 'RB')
1685        {
1686            y.innerHTML = "";
1687            header_loc = "import_stats.html?jobid=" + job_id;
1688        }
1689        else if(job_type == 'UD' || job_type == 'UDE')
1690        {
1691            y.innerHTML = "";
1692            header_loc = "user_domains_stats.html?jobid=" + job_id;
1693        }
1694        else if(job_type == 'BE')
1695        {
1696            y.innerHTML = "";
1697            header_loc = (typeof alias_page !== 'undefined' ? alias_page + (/\?/.test(alias_page) ? '&' : '?') : "blacklist.html?")+"jobid=" + job_id;
1698        }
1699        else if(job_type == 'CM')
1700        {
1701            y.innerHTML = "";
1702            header_loc = "/admin/max_margin.html?jobid=" + job_id;
1703        }
1704        document.location = header_loc;
1705    }
1706    else
1707    {
1708        y.innerHTML = "<div class='sucmsg2'>" + xmlHttp.responseText + "</div>";
1709    }
1710    return true;
1711}
1712
1713function fillBlackDomainsExportStatus()
1714{
1715	var comp;
1716	comp = 'f';
1717	
1718	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
1719	{
1720		x = document.getElementById('cust_report');
1721		if(xmlHttp.responseText == 't')
1722		{
1723			if(x)
1724			x.innerHTML = "<div id='imp_msg'><a href='export.html?file=black_domains'>Click here</a> to download the file</div>";
1725			comp = 't';
1726		}
1727		else if (xmlHttp.responseText != 't') {
1728			if(x)
1729			x.innerHTML = xmlHttp.responseText;
1730			comp = 't';
1731		}
1732		else
1733		{
1734			//x.innerHTML = "The data is being processed.<br>Please wait for few minutes...";
1735		}
1736		document.frmQuickSearch.ImportStatus.value = comp;
1737		return true;
1738	}
1739}
1740
1741function fillImportMessage()
1742{
1743	var comp;
1744	comp = 'f';
1745	
1746	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
1747	{
1748		x = document.getElementById('cust_report');
1749		if(xmlHttp.responseText == 't')
1750		{
1751			x.innerHTML = "<div id='imp_msg'><a href='export_stats.html'>Click here</a> to download the file</div>";
1752			comp = 't';
1753		}
1754		else if (xmlHttp.responseText != 't') {
1755			x.innerHTML = xmlHttp.responseText;
1756			comp = 't';
1757		}
1758		else
1759		{
1760			//x.innerHTML = "The data is being processed.<br>Please wait for few minutes...";
1761		}
1762		document.frmQuickSearch.ImportStatus.value = comp;
1763		return true;
1764	}
1765}
1766
1767function GetXmlHttpObject()
1768{ 
1769	var objXMLHttp=null;
1770	if(window.XMLHttpRequest)
1771	{
1772		objXMLHttp=new XMLHttpRequest();
1773	}
1774	else if(window.ActiveXObject)
1775	{
1776		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
1777	}
1778	return objXMLHttp;
1779}
1780
1781function ShowHideUpdateButton(selval)
1782{
1783	return true;
1784}
1785
1786function ShowHideColumnsCheckboxNew(frm,selval)
1787{
1788	var selval;
1789    a = document.getElementById("domtd");
1790    b = document.getElementById('disdomdemographics');
1791    c = document.getElementById('statscol_select1');
1792    d = document.getElementById('statscol_select2');
1793    // e = document.getElementById('rpmepcctrrow');
1794    f = document.getElementById("services_table");
1795    g = document.getElementById("serlabel");
1796    
1797    
1798    h = document.getElementById('slGroupBy');
1799    var groupby = g.value;
1800    
1801    i = document.getElementById("period_preset");
1802    selindex = parseInt(i.selectedIndex);
1803    selperiod = String(eval("frm.period_preset[" + selindex + "].value"));
1804    
1805    j = document.getElementById("distrafficsource");
1806    k = document.getElementById("epcrow");
1807    l = document.getElementById("ctrrow");
1808    m = document.getElementById("nctrrow");
1809    
1810    if(selval == 'folder' || selval == 'month' || selval == 'day'){
1811        a.style.display = '';
1812		//b.style.display = 'none';
1813		b.classList.add("disableTdCheckboxclass");
1814		$("input[name='chkdemographics").prop('disabled', true);
1815		$("input[name='chkdemographics").prop('checked', false);
1816		// e.style.display = '';
1817		c.style.display = 'none';
1818		d.style.display = '';
1819		// f.style.display = 'none';
1820		// f.classList.add("disableTdCheckboxclass");
1821		// g.style.display = 'none';
1822		// AS PER T5893 - IF ELSE
1823		if(selperiod == 'custom'){
1824			g.classList.remove("disableTdCheckboxclass");
1825			$("#serlabel input[type='checkbox'],#serlabel input[type='radio']").prop('disabled', false);
1826		}else{
1827			g.classList.add("disableTdCheckboxclass");
1828			$("#serlabel input[type='checkbox'],#serlabel input[type='radio']").prop('disabled', true);
1829			$("#serlabel input[type='checkbox']").prop('checked', false);
1830			$("#serlabel input[type='checkbox'][name='chkServices[]'][value='Totals']").prop('checked', true);
1831		}
1832
1833        // k.style.display = '';
1834        // l.style.display = '';
1835		// m.style.display = '';
1836		k.classList.remove("disableTdCheckboxclass");
1837		l.classList.remove("disableTdCheckboxclass");
1838		m.classList.remove("disableTdCheckboxclass");
1839		$("input[type='checkbox'][name='chkFrmColumns[CTR]']").prop('disabled', false);
1840		$("input[type='checkbox'][name='chkFrmColumns[nCTR]']").prop('disabled', false);
1841		$("input[type='checkbox'][name='chkFrmColumns[EPC]']").prop('disabled', false);
1842
1843		$("input[type='checkbox'][name='chkFrmColumns[RPM]']").prop('disabled', false);
1844		$("input[type='checkbox'][name='chkFrmColumns[RPM]']").closest('td').removeClass('disableTdCheckboxclass');
1845
1846		$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").prop('disabled', false);
1847		$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").closest('td').removeClass('disableTdCheckboxclass');
1848	}else if(selval == 'month_domain' 
1849			|| selval == 'month_service' 
1850			|| selval == 'month_folder' 
1851			|| selval == 'date_service' 
1852			|| selval == 'domain' 
1853			|| selval == 'compare_report')
1854	{
1855        a.style.display = '';
1856        
1857		/*
1858		if(e)
1859        if(selval == 'compare_report' || selval == 'month_domain'){
1860			e.style.display = '';
1861        }else{
1862        	e.style.display = 'none';
1863		}*/	
1864
1865        if(selval == 'domain'){
1866            c.style.display = '';
1867            d.style.display = 'none';
1868			// f.style.display = '';
1869			// f.classList.remove("disableTdCheckboxclass");
1870			// g.style.display = '';
1871			g.classList.remove("disableTdCheckboxclass");
1872			$("#serlabel input[type='checkbox'],#serlabel input[type='radio']").prop('disabled', false);
1873        }else{
1874            c.style.display = 'none';
1875			d.style.display = '';
1876			
1877			g.classList.remove("disableTdCheckboxclass");
1878			$("#serlabel input[type='checkbox'],#serlabel input[type='radio']").prop('disabled', false);
1879			if(selval == 'month_service' || selval == 'date_service'){ 
1880				$("#serlabel input[type='checkbox'][name='chkServices[]'][value='Totals']").prop('checked', false);
1881				$("#serlabel input[type='checkbox'][name='chkServices[]'][value='Totals']").prop('disabled', true);
1882			}else{
1883				$("#serlabel input[type='checkbox'][name='chkServices[]'][value='Totals']").prop('checked', true);	
1884			}
1885		}
1886		// k.style.display = 'none';
1887        // l.style.display = 'none';
1888		// m.style.display = 'none';
1889
1890		// if(selval == 'month_service' /*|| selval == 'month_folder' */){
1891		// 	$("input[type='checkbox'][name='chkFrmColumns[RPM]']").prop('checked', false);
1892		// 	$("input[type='checkbox'][name='chkColumns[]'][value='RPM']").prop('checked', false);
1893		// 	$("input[type='checkbox'][name='chkFrmColumns[RPM]']").closest('td').addClass('disableTdCheckboxclass');
1894		// 	$("input[type='checkbox'][name='chkFrmColumns[RPM]']").prop('disabled', true);
1895			
1896		// 	$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").prop('checked', false);
1897		// 	$("input[type='checkbox'][name='chkColumns[]'][value='nRPM']").prop('checked', false);
1898		// 	$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").closest('td').addClass('disableTdCheckboxclass');
1899		// 	$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").prop('disabled', true);
1900		// }else{
1901		// 	$("input[type='checkbox'][name='chkFrmColumns[RPM]']").prop('disabled', false);
1902		// 	$("input[type='checkbox'][name='chkFrmColumns[RPM]']").closest('td').removeClass('disableTdCheckboxclass');
1903
1904		// 	$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").prop('disabled', false);
1905		// 	$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").closest('td').removeClass('disableTdCheckboxclass');
1906		// }
1907
1908		$("input[type='checkbox'][name='chkFrmColumns[RPM]']").prop('disabled', false);
1909		$("input[type='checkbox'][name='chkFrmColumns[RPM]']").closest('td').removeClass('disableTdCheckboxclass');
1910
1911		$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").prop('disabled', false);
1912		$("input[type='checkbox'][name='chkFrmColumns[nRPM]']").closest('td').removeClass('disableTdCheckboxclass');
1913		
1914
1915		if(selval == 'month_domain' || selval == 'month_service' || selval == 'month_folder' || selval == 'date_service' ||  selval == 'compare_report'){
1916			k.classList.remove("disableTdCheckboxclass");
1917			l.classList.remove("disableTdCheckboxclass");
1918			m.classList.remove("disableTdCheckboxclass");
1919			$("input[type='checkbox'][name='chkFrmColumns[CTR]']").prop('disabled', false);
1920			$("input[type='checkbox'][name='chkFrmColumns[nCTR]']").prop('disabled', false);
1921			$("input[type='checkbox'][name='chkFrmColumns[EPC]']").prop('disabled', false);
1922		}else{
1923			// $("input[type='checkbox'][name='chkFrmColumns[CTR]']").prop('checked', false);
1924			// $("input[type='checkbox'][name='chkFrmColumns[nCTR]']").prop('checked', false);
1925			// $("input[type='checkbox'][name='chkFrmColumns[EPC]']").prop('checked', false);
1926			// $("input[type='checkbox'][name='chkColumns[]'][value='CTR']").prop('checked', false);
1927			// $("input[type='checkbox'][name='chkColumns[]'][value='nCTR']").prop('checked', false);
1928			// $("input[type='checkbox'][name='chkColumns[]'][value='EPC']").prop('checked', false);
1929			// k.classList.add("disableTdCheckboxclass");
1930			// l.classList.add("disableTdCheckboxclass");
1931			// m.classList.add("disableTdCheckboxclass");
1932			// $("input[type='checkbox'][name='chkFrmColumns[CTR]']").prop('disabled', true);
1933			// $("input[type='checkbox'][name='chkFrmColumns[nCTR]']").prop('disabled', true);
1934			// $("input[type='checkbox'][name='chkFrmColumns[EPC]']").prop('disabled', true);
1935		}
1936    }else{
1937        a.style.display = 'none';
1938        f.style.display = 'none';
1939        g.style.display = 'none';
1940        k.style.display = 'none';
1941        l.style.display = 'none';
1942        m.style.display = 'none';
1943    }
1944        
1945    if(b)
1946    if(selperiod == 'alltime' || selval == 'month_service' /*|| selval == 'month_folder'*/ || selval == 'compare_report'){
1947		// b.style.display = 'none';
1948		b.classList.add("disableTdCheckboxclass");
1949		$("input[name='chkdemographics").prop('disabled', true);
1950		$("input[name='chkdemographics").prop('checked', false);
1951    }else{
1952		// b.style.display = '';
1953		b.classList.remove("disableTdCheckboxclass");
1954		$("input[name='chkdemographics").prop('disabled', false);
1955    }
1956    
1957    if(j)
1958    if(selperiod == 'alltime' || (selval != 'month_domain' && selval != 'domain')){
1959		//j.style.display = 'none';
1960		j.classList.add("disableTdCheckboxclass");
1961		$("input[name='chktrafficsource").prop('disabled', true);
1962		$("input[name='chktrafficsource").prop('checked', false);
1963    }else{
1964		// j.style.display = '';
1965		j.classList.remove("disableTdCheckboxclass");
1966		$("input[name='chktrafficsource").prop('disabled', false);
1967	}	
1968}
1969
1970function ShowHideColumnsCheckbox(frm,selval)
1971{
1972	var selval;
1973    a = document.getElementById("domtd");
1974    b = document.getElementById('disdomdemographics');
1975    c = document.getElementById('statscol_select1');
1976    d = document.getElementById('statscol_select2');
1977    e = document.getElementById('rpmepcctrrow');
1978    f = document.getElementById("services_table");
1979    g = document.getElementById("serlabel");
1980    z = document.getElementById("maxrevenuecol");
1981    
1982    h = document.getElementById('slGroupBy');
1983    var groupby = g.value;
1984    
1985    i = document.getElementById("period_preset");
1986    selindex = parseInt(i.selectedIndex);
1987    selperiod = String(eval("frm.period_preset[" + selindex + "].value"));
1988    
1989    j = document.getElementById("distrafficsource");
1990    k = document.getElementById("epcrow");
1991    l = document.getElementById("ctrrow");
1992    m = document.getElementById("nctrrow");
1993    
1994    
1995    if(selval == 'folder' || selval == 'month' || selval == 'day')
1996    {
1997        a.style.display = '';
1998        b.style.display = 'none';
1999        e.style.display = '';
2000        c.style.display = 'none';
2001        d.style.display = '';
2002        f.style.display = 'none';
2003        g.style.display = 'none';
2004        k.style.display = '';
2005        l.style.display = '';
2006        m.style.display = '';
2007    }
2008    else if(selval == 'month_domain' || selval == 'month_service' || selval == 'date_service' || selval == 'domain' || selval == 'compare_report')
2009    {
2010        a.style.display = '';
2011        
2012        if(e)
2013        if(selval == 'compare_report' || selval == 'month_domain')
2014        {
2015            e.style.display = '';
2016        }
2017        else
2018        e.style.display = 'none';
2019        
2020        if(selval == 'domain')
2021        {
2022            c.style.display = '';
2023            d.style.display = 'none';
2024            f.style.display = '';
2025            g.style.display = '';
2026        }
2027        else
2028        {
2029            c.style.display = 'none';
2030            d.style.display = '';
2031            if(selval == 'compare_report')
2032            {
2033                f.style.display = '';
2034                g.style.display = '';
2035            }
2036            else
2037            {
2038                f.style.display = 'none';
2039                g.style.display = 'none';
2040            }
2041        }
2042        k != null ? k.style.display = 'none' : null;
2043        l != null ? l.style.display = 'none' : null;
2044        m != null ? m.style.display = 'none' : null;
2045    }
2046    else
2047    {
2048        a.style.display = 'none';
2049        f.style.display = 'none';
2050        g.style.display = 'none';
2051        k.style.display = 'none';
2052        l.style.display = 'none';
2053        m.style.display = 'none';
2054    }
2055        
2056    if(selval == 'month_domain')
2057        z.style.display = '';
2058    else
2059        z.style.display = 'none';
2060    
2061    if(b)
2062    if(selperiod == 'alltime' || selval == 'month_service' || selval == 'compare_report')
2063        b.style.display = 'none';
2064    else
2065        b.style.display = '';
2066    
2067    
2068    if(j)
2069    if(selperiod == 'alltime' || (selval != 'month_domain' && selval != 'domain'))
2070        j.style.display = 'none';
2071    else
2072        j.style.display = '';
2073}
2074
2075function ShowHideComparisonFields(selval)
2076{
2077	var selval;
2078	a = document.getElementById("comparing_row");
2079	b = document.getElementById("todaterow");
2080	c = document.getElementById("fromdaterow");
2081	d = document.getElementById("periodrow");
2082	
2083	if(selval == 'compare_report')
2084	{
2085		a.style.display = '';
2086		b.style.display = 'none';
2087		c.style.display = 'none';
2088		d.style.display = 'none';
2089	}
2090	else
2091	{
2092		a.style.display = 'none';
2093		b.style.display = '';
2094		c.style.display = '';
2095		d.style.display = '';
2096	}
2097
2098	return true;
2099}
2100
2101function ShowHideObject(obj)
2102{
2103    var selval;
2104    x = document.getElementById(obj);
2105    
2106    if(x.style.display == 'none')
2107        x.style.display = '';
2108    else
2109        x.style.display = 'none';
2110    return true;
2111}
2112
2113function validateTxtArea(){
2114if (document.getElementById('domains').value){
2115    var textarea = document.getElementById('domains').value;
2116    var myArr = new Array();
2117    myArr = textarea.split("\n");
2118    var j = 0;
2119    for (i=0;i<myArr.length;i++){
2120        var mystr = myArr[i].replace(/^\s+|\s+$/g,"");
2121        if (mystr){
2122            j++;
2123        }
2124    }
2125    if (j == 0){
2126        document.getElementById('domains').focus();
2127        alert ("Please specify the domains");
2128        return false;
2129    }
2130    else {
2131        return true;
2132    }
2133}
2134else {
2135	alert ("Please specify the domains");
2136    document.getElementById('domains').focus();
2137    return false;
2138}
2139 return false;
2140}
2141
2142function Select_DeSelectAllChkbox(chk,onload) {
2143	var checkboxes = "";
2144	if(chk == "chkBoxAll" && (document.form_status))checkboxes = document.form_status.getElementsByTagName("input");
2145	else if(chk == "chk_domains" && (document.snatch_chk))checkboxes = document.snatch_chk.getElementsByTagName("input");
2146	if(onload == 'true' && document.getElementById(chk)){
2147		document.getElementById(chk).checked = false;
2148		 for(i=0;i<checkboxes.length;i++) {
2149			if(checkboxes.item(i).attributes["type"].value == "checkbox") {
2150				checkboxes.item(i).checked = false;
2151			 }
2152		}
2153	}
2154	if(document.getElementById(chk) && document.getElementById(chk).checked == true){
2155		 for(i=0;i<checkboxes.length;i++) {
2156			  if(checkboxes.item(i).attributes["type"].value == "checkbox") {
2157				 checkboxes.item(i).checked = true;
2158		 }
2159        }
2160        }else{
2161        for(i=0;i<checkboxes.length;i++) {
2162            if(checkboxes.item(i).attributes["type"].value == "checkbox") {
2163                checkboxes.item(i).checked = false;
2164            }
2165        }
2166    }
2167}
2168
2169function isValidDate(d) {
2170	dateParts = d.split('-');
2171	dObj = new Date(dateParts[0], dateParts[1], dateParts[2]);
2172
2173	// Was a date object created?
2174	if (Object.prototype.toString.call(dObj) !== "[object Date]" )
2175		return false;
2176
2177	// Has it got a valid time associated with it?
2178	return !isNaN(dObj.getTime());
2179}
2180
2181//function to show domain names and copy them to clipboard
2182function show_MovedDomainName(element_id,domain_name_string) {
2183	var domain_name	= domain_name_string.replace(/,/g, "\r\n");
2184//    alert(domain_name);
2185	document.getElementById('moved_domain_name').innerText=domain_name;
2186}
2187
2188function show_Conflicts(element_id,domain_name_user_string) {
2189    var domain_name_user    = domain_name_user_string.replace(/___/g, '<br>');
2190    document.getElementById('moved_domain_name').innerHTML=domain_name_user;
2191}
2192
2193function globalSetCookie(cname, cvalue, exdays, path, domain) {
2194	path = (typeof path === 'undefined') ? '/' : path;
2195	domain = (typeof domain === 'undefined') ? 'above.com' : domain;
2196
2197	var cookieStr = cname + "=" + cvalue;
2198	if (exdays != 0) {
2199		var d = new Date();
2200		d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
2201		cookieStr += ";expires=" + d.toUTCString();
2202	}
2203	if(path) cookieStr += ";path=" + path;
2204	if(domain) cookieStr += ";domain=" + domain;
2205	document.cookie = cookieStr;
2206}
2207
2208function globalGetCookie(cname) {
2209	var name = cname + "=";
2210	var ca = document.cookie.split(';');
2211	for(var i = 0; i < ca.length; i++) {
2212		var c = ca[i];
2213		while (c.charAt(0) == ' ') {
2214			c = c.substring(1);
2215		}
2216		if (c.indexOf(name) == 0) {
2217			return c.substring(name.length, c.length);
2218		}
2219	}
2220	return "";
2221}
2222
2223function open_page(file, tab, search, target) {
2224	if(typeof file === 'undefined') {
2225		return false;
2226	}
2227
2228	tab = typeof tab === 'undefined' ? '' : tab;
2229	search = typeof search === 'undefined' ? '' : search;
2230	target = typeof target === 'undefined' ? '_self' : target;
2231
2232	var cookiename = file.replace(/-/, '_');
2233	cookiename = cookiename+"_active_tab";
2234
2235	var domain = window.location.hostname.replace(/^(www|new)\./, '');
2236
2237	if(tab != "") {
2238		globalSetCookie(cookiename, tab, 0, '/', domain);
2239	}
2240
2241	redir_url = file+'.html'
2242	if(search != "") {
2243		redir_url = redir_url+"?"+search;
2244	}
2245
2246	window.open(redir_url, target);
2247}
2248
2249var hi = null;
2250var hideele = {};
2251
2252function hideAfterInterval(eles, sec) {
2253	$.each(eles, function(k, v) {
2254		if($(v).length && $(v).is(':visible')) {
2255			hideele[v] = sec;
2256		}
2257	});
2258
2259	if(hi === null) {
2260		hi = setInterval(function() {
2261			$.each(hideele, function(k, v) {
2262				hideele[k] = v - 1;
2263
2264				if(hideele[k] == 0) {
2265					$(k).remove();
2266					delete hideele[k];
2267				}
2268			});
2269
2270			var c = 0;
2271			$.each(hideele, function(k, v) { c++; });
2272			if(c == 0) {
2273				clearInterval(hi);
2274				hi = null;
2275			}
2276		}, 1000);
2277	}
2278}
2279
2280function hideOnClick(eles) {
2281	$(eles).on('click', function() {
2282		$.each(hideele, function(k, v) {
2283			$(k).remove();
2284			delete hideele[k];
2285		});
2286
2287		if(hi) clearInterval(hi);
2288		hi = null;
2289	});
2290}
2291
2292/**
2293 * addHiddenData() {{{
2294 * add required hidden elements on page, when update is successful
2295 */
2296function addHiddenData(did, key, real_value) {
2297	if(
2298		key == 'il_minoffer'
2299		|| key == 'il_reserve'
2300		|| key == 'il_bin'
2301		|| key == 'il_showtraffic'
2302		|| key == 'il_showrevenue'
2303		|| key == 'il_isadult'
2304	) {
2305		var eleid = key.replace(/^il_/g, '');
2306		eleid = did+"_"+eleid;
2307
2308		if(
2309			key == 'il_minoffer'
2310			|| key == 'il_reserve'
2311			|| key == 'il_bin'
2312		) {
2313			real_value = real_value.replace(/(\$|,|^\s+|\s+$)/g, '');
2314			real_value = real_value == "" ? "" : parseFloat(real_value);
2315		}
2316		else if(
2317			key == 'il_showtraffic'
2318			|| key == 'il_showrevenue'
2319			|| key == 'il_isadult'
2320		) {
2321			real_value = real_value == 'Y' ? 't' : 'f';
2322		}
2323
2324		$('#dname_'+did).parent().find('#'+eleid).remove();
2325		$('#dname_'+did).parent().append("<input type='hidden' id='"+eleid+"' value='"+real_value+"'>");
2326	}
2327} /* }}} */
2328
2329/**
2330 * ExportDomainsOnPage() {{{
2331 * check which is the tab open on the page; export domains for open tab
2332 */
2333function ExportDomainsOnPage() {
2334	var page = $('.subnav td.tabblue1 > a').attr('onclick');
2335	page = page.replace(/^showTabs\(\'/, '');
2336	page = page.replace(/\',\s*this\);/, '');
2337
2338	if(document.location.hash) document.location.hash = '';
2339	var url = document.location.href.replace('#', '');
2340	document.location.href = url+(/\?/.test(url) ? '&' : '?')+'action=export&page='+page;
2341} /* }}} */
2342
2343/**
2344 * preAddDomains() {{{
2345 * as per RT: 857366
2346 */
2347function preAddDomains(selFolder, brFolder, form) {
2348	var brokered_folder_restriction_toggle_flag =  document.getElementById('brokered_folder_restriction_toggle_flag');
2349	if (typeof(brokered_folder_restriction_toggle_flag) != 'undefined' && brokered_folder_restriction_toggle_flag == 1 ){
2350		if(selFolder == brFolder && $('#broker_service_approval_status').val() == 'p') {
2351			alert("Brokerage Service Application Pending - Please contact your account manager");
2352			return false;
2353		}
2354		else if(selFolder == brFolder && $('#broker_service_approval_status').val() == 'f') {
2355			alert("Brokerage Service Application Pending - Please contact your account manager.");
2356			return false;
2357		}
2358		else if(selFolder == brFolder && $('#broker_service').val() == 't') {
2359			$('#accept_brokered_confirm').dialog('close');
2360			$('#accept_brokered_confirm').remove();
2361			var content = "<div id='accept_brokered_confirm' style='display:none;'>\
2362				<style>\
2363				.ui-dialog { z-index: 1004;position: fixed; }\
2364				.ui-front { z-index: 1003; }\
2365				.acctermBtn { border: 0!important;opacity: 1!important; }\
2366				.acctermBtn > span { background: #333333;border: 0;color: #ffffff;font-size: 13px;font-weight: bold;padding: 5px 20px;text-align: center; }\
2367				</style>\
2368				<div class='aC mT5'>Please accept our <a href='/terms-of-service.html#Above.com_Marketplace_Terms' target='_blank'>Terms & Conditions</a></div>\
2369				</div>";
2370			$('body').append(content);
2371	
2372			var theDialog = $('#accept_brokered_confirm').dialog({
2373				autoOpen: false,
2374				modal: true,
2375				draggable: false,
2376				closeOnEscape: false,
2377				height: 150,
2378				width: 400,
2379				resizable: false,
2380				title: "Terms of Acceptance",
2381				buttons: [{
2382					text: 'Accept',
2383					class: "acctermBtn",
2384					click: function() {
2385						$('#accept_brokered').val('1');
2386						if(typeof form !== 'undefined') {
2387							$(form).find('[name=qckAddSub]').click();
2388							return false;
2389						}
2390						else {
2391							return doAction($('<input value="Move">'));
2392						}
2393					}
2394				}, {
2395					text: 'Reject',
2396					class: "acctermBtn",
2397					click: function() {
2398						$(this).dialog('close');
2399						return false;
2400					}
2401				}],
2402				close: function() {
2403					$('#accept_brokered').val('0');
2404					$('#accept_brokered_confirm').remove();
2405				}
2406			});
2407			theDialog.dialog('open');
2408		}
2409		
2410		if(selFolder == brFolder && $('#broker_service').val() != 't') {
2411			$('#accept_brokered_confirm').dialog('close');
2412			$('#accept_brokered_confirm').remove();
2413			var content = "<div id='accept_brokered_confirm' style='display:none;'>\
2414				<style>\
2415				.ui-dialog { z-index: 1004;position: fixed; }\
2416				.ui-front { z-index: 1003; }\
2417				.acctermBtn { border: 0!important;opacity: 1!important; }\
2418				.acctermBtn > span { background: #333333;border: 0;color: #ffffff;font-size: 13px;font-weight: bold;padding: 5px 20px;text-align: center; }\
2419				</style>\
2420				<div class='aC mT5'>Domains can not be added to this folder. Please apply for <a href='/brokerage-settings.html'>Brokerage service here</a>.</div>\
2421				</div>";
2422			$('body').append(content);
2423			
2424			var theDialog = $('#accept_brokered_confirm').dialog({
2425				autoOpen: false,
2426				modal: true,
2427				draggable: false,
2428				closeOnEscape: false,
2429				height: 70,
2430				width: 600,
2431				resizable: false,
2432				title: "Message",
2433				close: function() {
2434					$('#accept_brokered_confirm').remove();
2435				}
2436			});
2437			theDialog.dialog('open');
2438			
2439			return false;
2440		}
2441	}
2442	else{
2443		if(selFolder == brFolder && $('#accept_brokered').val() != '1') {
2444			$('#accept_brokered_confirm').dialog('close');
2445			$('#accept_brokered_confirm').remove();
2446			var content = "<div id='accept_brokered_confirm' style='display:none;'>\
2447				<style>\
2448				.ui-dialog { z-index: 1004;position: fixed; }\
2449				.ui-front { z-index: 1003; }\
2450				.acctermBtn { border: 0!important;opacity: 1!important; }\
2451				.acctermBtn > span { background: #333333;border: 0;color: #ffffff;font-size: 13px;font-weight: bold;padding: 5px 20px;text-align: center; }\
2452				</style>\
2453				<div class='aC mT5'>Please accept our <a href='/terms-of-service.html#Above.com_Marketplace_Terms' target='_blank'>Terms & Conditions</a></div>\
2454				</div>";
2455			$('body').append(content);
2456	
2457			var theDialog = $('#accept_brokered_confirm').dialog({
2458				autoOpen: false,
2459				modal: true,
2460				draggable: false,
2461				closeOnEscape: false,
2462				height: 150,
2463				width: 400,
2464				resizable: false,
2465				title: "Terms of Acceptance",
2466				buttons: [{
2467					text: 'Accept',
2468					class: "acctermBtn",
2469					click: function() {
2470						$('#accept_brokered').val('1');
2471						if(typeof form !== 'undefined') {
2472							$(form).find('[name=qckAddSub]').click();
2473						}
2474						else {
2475							doAction($('<input value="Move">'));
2476						}
2477					}
2478				}, {
2479					text: 'Reject',
2480					class: "acctermBtn",
2481					click: function() {
2482						$(this).dialog('close');
2483					}
2484				}],
2485				close: function() {
2486					$('#accept_brokered').val('0');
2487					$('#accept_brokered_confirm').remove();
2488				}
2489			});
2490			theDialog.dialog('open');
2491			
2492			return false;
2493		}
2494	}
2495
2496	return true;
2497} /* }}} */
2498
2499/**
2500 * is_numeric() {{{
2501 * validation for numeric 
2502 */
2503function is_numeric(number){
2504        var regex = /(^\d+$)|(^\d+\.\d+$)|(^[\d.]*$)/;
2505        if (regex.test(number)){
2506                return true;
2507        }
2508        return false;
2509} /* }}} */
2510
2511/**
2512 * is_null() {{{
2513 * validation for null 
2514 */
2515function is_null(text) {
2516        var regex = /^\s*$/;
2517        if(regex.test(text)){
2518                return true;
2519        }
2520        return false;
2521}/* }}} */
2522
2523/**
2524 * getActionRequiredDialog() {{{
2525 * as per T94
2526 *
2527 * function to display confirmation popup to user
2528 */
2529var action_content = '';
2530function getActionRequiredDialog(jobid, reload) {
2531	reload = (typeof reload === 'undefined') ? 0 : reload;
2532	var content = "<div id='action_popup' style='padding:35px 10px 0 10px;'>\
2533		<div style='text-align:center;padding-bottom:28px;'>\
2534		<img src='/img/ajax-loader.gif' tooltip='Loading. Please wait ...'>\
2535		</div></div>";
2536
2537	if(reload) action_content = '';
2538
2539	var opts = {
2540		html: content,
2541		open: true,
2542		width: 420,
2543		maxHeight: '75%',
2544		overlayClose: false,
2545		fixed: true
2546	};
2547
2548	if(action_content != '') {
2549		opts.onComplete = function() {
2550			showActionRequiredContent(jobid);
2551		}
2552	}
2553	else {
2554		opts.onComplete = function() {
2555			$.ajax({
2556				type: 'post',
2557				url: '/tasks.html',
2558				data: {
2559					jobid: jobid,
2560					action: 'action_popup'
2561				},
2562				beforeSend: function() { $.colorbox.resize(); },
2563				success: function(res) {
2564					if(typeof res === 'object' && res.status == 1) {
2565						if(typeof res.redirect !== 'undefined') {
2566							document.location.href = res.redirect;
2567							return true;
2568						}
2569						action_content = res.content;
2570					}
2571					else {
2572						if(typeof res === 'undefined' || typeof res.msg === 'undefined' || !res.msg) {
2573							res = { msg: "Something went wrong. Please try again." };
2574						}
2575						action_content = "<div style='text-align:center;padding-bottom:28px;'>"+res.msg+"</div>";
2576					}
2577
2578					showActionRequiredContent(jobid);
2579				}
2580			});
2581		};
2582	}
2583
2584	$.colorbox(opts);
2585} /* }}} */
2586
2587/**
2588 * showActionRequiredContent() {{{
2589 * as per T94
2590 *
2591 * function to fill confirmation popup with content
2592 */
2593function showActionRequiredContent(jobid) {
2594	$('#action_popup').html(action_content);
2595
2596	var fele = $('#action_popup').find('form[name=frmQuickAddForm]');
2597	if(fele.length) {
2598		fele.append('<input type="hidden" name="action" value="action_popup">');
2599		fele.append('<input type="hidden" name="jobid" value="'+jobid+'">');
2600	}
2601
2602	$('.inline').click(function(e) {
2603		if($(this).hasClass('clicked')) return true;
2604		e.stopImmediatePropagation();
2605		$(this).addClass('clicked');
2606		$(this).colorbox({
2607			inline: true,
2608			fixed: true,
2609			width: "25%",
2610			maxHeight: '75%',
2611			onClosed: function() {
2612				getActionRequiredDialog(jobid);
2613			}
2614		});
2615		$(this).trigger('click');
2616	});
2617
2618	$.colorbox.resize();
2619} /* }}} */
2620
2621/**
2622 * show_customize_form() {{{
2623 */
2624function show_customize_form() {
2625	$.colorbox({
2626		html: $('#customize_view').html(),
2627		open: true,
2628		width: 470,
2629		height: 660,
2630		speed:1,
2631		fadeOut:1,
2632		fixed: false,
2633		onComplete: function() {
2634			var ele = $('#colorbox .popupbox').parent();
2635			var h = ele.parent().height();
2636			ele.height(h);
2637			ele.css({ 'margin-bottom': '0px' });
2638			// as per RT: id=801107
2639			ele.find("#sortable").sortable();
2640		}
2641	});
2642} /* }}} */
2643
2644/**
2645 * save_view_preference() {{{
2646 */
2647function save_view_preference() {
2648	var order ="";
2649	$('#colorbox .popupbox').find('li').each(function() {
2650		var index = $(this).index();
2651		var header = $(this).find('label').attr("for");
2652		var selected = 'f';
2653		if($(this).find('input').is(":checked")){
2654			selected = 't';
2655		}
2656		order += header +", "+ selected +";"; 
2657	});
2658	order = order.replace(/;$/, "");
2659	$('#colorbox .popupbox #order').val(order);
2660	$('#colorbox .popupbox #save_view_preference').submit();
2661} /* }}} */
2662
2663// isset(val) : function to check if variable 'val' has any kind(string, int, object) of value set
2664function isset(val)
2665{
2666	if (typeof val == 'undefined')
2667		return false;
2668
2669	if (val == null)
2670		return false;
2671
2672	if (typeof val == 'string' && val.trim() == '')
2673		return false;
2674
2675	if (typeof val == 'object')
2676		return isObjectSet(val);
2677
2678	return true;
2679}
2680
2681// isObjectSet(obj) : function to check if variable 'obj' has any value set i.e if it's not an empty object
2682function isObjectSet(obj)
2683{
2684	for (let key in obj)
2685	{
2686		if (obj.hasOwnProperty(key))
2687			return true;
2688	}
2689	return false;
2690}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.