//Function to jump to another forum
function selPost(ide,checked)
{
	var lbl = document.getElementById("txtSelPost");
	if(checked){					
		lbl.value = lbl.value + "," + ide + "," ;
	}else
	{
		var index = lbl.value.indexOf(","+ide+",");
		if(index>0){
			lbl.value = lbl.value.substring(0,index-1) + lbl.value.substring(index+ide.length+1);
		}
		if(index==0){
			lbl.value = lbl.value.substring(ide.length + 2);
		}
	}				
}

function openInMainWin(winLocation){
	window.opener.location.href = winLocation
	window.opener.focus();
	window.close();
}

function CheckAllDataGridCheckBoxes(aspCheckBoxID,checkval) {
	var lbl = document.getElementById("txtSelPost");	
	if(checkval){								
		lbl.value = "";
	}
	re = new RegExp(':' + aspCheckBoxID + '$')  //generated control name starts with a colon		        
	var check = document.getElementById("gridPostsToReview__ctl2_chkSelPost")
	for(i = 0; i < FormTopicList.elements.length; i++) {
		elm = FormTopicList.elements[i]
			if (elm.type == 'checkbox') {
			    if (re.test(elm.name)) {
			        elm.checked = checkval;
			        var strEv = elm.onclick.toString();
			        var temp = strEv.substring(strEv.indexOf("selPost('")+12)
			        var id = strEv.substring(strEv.indexOf("selPost('")+12).substring(0,temp.indexOf("',this"));
			        selPost(id,checkval);
				}
			}
	}				
	return false;
}

function ForumJump(URL) {	
	if (URL.options[URL.selectedIndex].value == "0")
	{
		URL.selectedIndex = 0;
		return true;
	}
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}
function GetResults()
{
    var cad = "?option=" + SearchBar.option.value;
	cad = cad + "&text=" + escape(SearchBar.text.value);
	document.location = "SearchResults.aspx" + cad;
}

//Function to open pop up window
function openWin(theURL,winName,features) {
	window.open(theURL,winName,features);
}


//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){
	
	now = new Date  
	
	//Open the window first 	
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
   		
   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();	
	formName.target = "preview";
	formName.submit();
}
function OpenPreviewWindow(targetPage, formName){
	
	now = new Date  
	
	//Open the window first 	
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
   		
   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();	
	formName.target = "preview";
	formName.submit();
}

function openWinUpload(theURL,winName,features) {
	var myfile = '';
	var myfilepath = '';
	var arrValues = new Array();	
  	var arrValues = window.showModalDialog('PopUpUpload.aspx?FT=avatar','Name',features);
  	if (arrValues != null) {  		  					
		myfile = arrValues[0];
		myfilepath = arrValues[1];
		alert('My File Path :' + myfilepath);
// 	var value = window.showModalDialog('PopUpUpload.aspx?FT=avatar','Name',features);
  		frmRegister.avatar.src = myfilepath;
  		frmRegister.newAvatar.value = myfilepath;
  	}
}

