var POP_UP_PARAMS_ADVERTISER_RANKING = 'width=520,height=460,status=no,toolbar=no,scrollbars=yes';


// close the "processing" window
function closeProcessing() {
	var procWnd = window.open('about:blank','procWnd','width=10,height=10,left=0,top=0,menubar=no,location=no,scrollbars=no,status=no');
	if(procWnd) procWnd.close();
}

// show the "processing" window
function showProcessing() {
	var procWnd = window.open('../processing.aspx','procWnd','height=170,width=400,screenX=300,left=300,screenY=200,top=200,resizeable=no,menubar=no,toolbar=no');
	if(procWnd) procWnd.focus();
}

function popUp(theURL,winName,features) {
	w = window.open(theURL,winName,features);
	if (window.focus) {
		w.focus();
	}
}

function popHelp(theURL,winName,features,helptext) {
	
	w = window.open(theURL,winName,features);
	if (window.focus) {
		w.focus();
	}
	s = '<html><head><title>CAS - Help</title><link href="../Styles.css" type="text/css" rel="stylesheet"></head><body bgcolor="#0077bb"><p align="center" class="whiteBoldText"><br>' + helptext + '</p><p align="center" class="whiteBoldText"><a href="javascript:this.close();" class="whiteBoldText">Close Window</a></p></body></html>';
	w.document.write( s );
}

function setLoginFocus()
    {
      loginForm.UID.focus();
    }

function popImage(imgURL){
	var wnd_img = window.open(imgURL,"wnd_img","width=820,height=710,left=50,top=20,resizeable=yes,menubar=no,location=no,scrollbars=yes,status=no");
	wnd_img.focus();
}

function validateLBAndShowProcessing(lb){
	var listbox = document.all(lb);
	if(listbox.value.length > 0) showProcessing();

return true;
}

function getElement(name){
	if(document.getElementById) return document.getElementById(name);
	else if(document.all) return document.all[name];
	else return null;
}

function groupExpandClick(img, gid, ind){
	var tbl = getElement('ctrl_grd');
	var searchStr = 'ctrl_grditem_' + gid + '_';
	var flag = false;
	
	if(tbl){
		for(var i = ind; i < tbl.rows.length; i++){
			if(tbl.rows[i].id.indexOf(searchStr) != -1){
				if(tbl.rows[i].style.display == ''){
					tbl.rows[i].style.display = 'none'; 
					img.src = '../images/plus.png';
					img.title = 'Click to show group members data';
				}
				else{
					tbl.rows[i].style.display = '';
					img.src = '../images/minus.png';
					img.title = 'Click to hide group members data';
				}
				flag = true;
			}
			else{
				if(flag == true) break;
			}
		}
	}
	
	return false;
}


var isPageDirty = false;
function dirtyPage(){
	isPageDirty = true;
}

function pageClick(){
	if(isPageDirty){
		var answer = confirm('Data has been modified. Press [OK] to save and continue or [Cancel] to remain on the current page.');
		isPageDirty = !answer;
		
		if(answer){
			var thisForm = document.Form1;
			if(!thisForm) thisForm = document.forms['Form1'];
			if(thisForm) thisForm.hdnPreSave.value = 'true';
		}
		
		return answer;
	}
	
	return true;
}


