function testFunc() {
	alert('text hello');
	}
// popupWindow function
// This is where you set your specific height & width etc... for your popups.
function openPopup(url,popType) {
	if (popType==1)
		window.open(url, 'popupwindow', 'width=735,height=760,scrollbars,resizable'); 
	else
		window.open(url);
	return false;
	}

function setFocus(formName, field) {
	eval('document.'+formName+'.'+field+'.focus()');
	}


$(document).load(function(){

	$("form#fil").hide()
	$("#hs-file-group").hide()

	//if ($.query()['grpdel'])
		//alert('yep');
	
	
	fileCntVar = 1;
	grpCntVar = 1;
	
	
	// Live user search
	$("input#search").keyup(function(){
		showHint(this.value);
		});
	
	
	$("a#switch-fil").click(function(){
		/* if button is clicked when "up" */
		if (fileCntVar == 1){

			/* button toggle value */
			fileCntVar = 0;
			$("#hs-file-group").hide();
			$("form#fil").show();
			
 			$(this).addClass("on");
			$("a#switch-grp").removeClass("on");
		
		/* if button is clicked when "down" */
		} else if (fileCntVar == 0) {
			fileCntVar = 1;
			$("form#dir").hide();
			$("form#fil").hide();
			
 			$(this).removeClass("on");
		}
		/*reset the other button to "up" state*/
		grpCntVar = 1;
		
		return false;
	});
	
		
	$("a#switch-grp").click(function(){
	
		/* if button is clicked when "up" */
		if (grpCntVar == 1){
		
			/* button toggle value */
			grpCntVar = 0;
			$("form#fil").hide();
			$("#hs-file-group").show();
			
 			$(this).addClass("on");
			$("a#switch-fil").removeClass("on");
			//$("input#grp-title").focus();
			
		/* if button is clicked when "down" */
		} else if (grpCntVar == 0){
			grpCntVar = 1;
			$("form#fil").hide();
			$("#hs-file-group").hide();
			
 			$(this).removeClass("on");
		}
		/*reset the other button to "up" state*/
		fileCntVar = 1;
		
		//$("#txt-name").focus();
		return false;
	});	
		
	
	
	// Popups and external links.
	$("a.popup").click(function(){
		var url = this.href;
		openPopup(url,1);
		return false;
		})
	
	$("a.external").click(function(){
		var url = this.href;
		openPopup(url,2);
		return false;
		})
	
	

var company_type = $("input[@name='User_Reg_Type']:checked").val();

if (company_type == 1)
{
$("#indiv_questions").hide();
$("#company_questions").show();	
}
else if(company_type == 2)
{
$("#indiv_questions").show();
$("#company_questions").hide(); 
}
else
{
	$("#indiv_questions").hide();
	$("#company_questions").hide();
}

/* $("input[@name='User_Reg_Type']:checked").val() == 1 ? ($(".indiv_questions").hide(),$(".company_questions").show()): ($(".indiv_questions").show(),$(".company_questions").hide()); */


$("#rad-User_Reg_Type-1").click(function() {

$('#company_questions').show();
$('#indiv_questions').hide();
});
$("#rad-User_Reg_Type-2").click(function() {

$('#company_questions').hide();
$('#indiv_questions').show();

});
	
	});
function formatCells(xls){
  document.forms[0].elements['input_box'].value = '';
  var charcount = xls.length;
  var precount = charcount-1;
  var checkEnd = xls.substring(charcount,precount);
  
  if (checkEnd == "\n")
  {
     var xls = xls.substring(0,precount);
  }
  else
  {

  }
  

  var row = 1;
    // make array of rows based on /n
	var arrRow = xls.split(/\n/gi);
    // loop through these rows
	for(var i=0;i<arrRow.length;i++){
	 // split up the row into separate thingys
	 arrRow[i] = arrRow[i].replace(/\t\t/gi,'\t-\t');

	 var arrGroup = arrRow[i].split(/\t/gi);
		
		for(var j=0;j<arrGroup.length;j++){
		
		var elementName =  "tableRow[" + row + "][" + j + "]";
		if (document.forms[1].elements[elementName])
		{
		document.forms[1].elements[elementName].value = arrGroup[j];
		}
		else
		{
   	 	alert('The copy area and paste area are not the same size and shape.');	
		return;
		}
	
		}
			
		var row = row + 1;

    }
	
  }
  
 function formatCellsGE(xls){
  document.forms['ge_input_box'].elements['input_box'].value = '';
  var charcount = xls.length;
  var precount = charcount-1;
  var checkEnd = xls.substring(charcount,precount);
  
  if (checkEnd == "\n")
  {
     var xls = xls.substring(0,precount);
  }
  else
  {

  }
  

  var row = 1;
    // make array of rows based on /n
	var arrRow = xls.split(/\n/gi);
    // loop through these rows
	for(var i=0;i<arrRow.length;i++){
	 // split up the row into separate thingys
	 arrRow[i] = arrRow[i].replace(/\t\t/gi,'\t-\t');
	 var arrGroup = arrRow[i].split(/\t/gi);
		
		for(var j=0;j<arrGroup.length;j++){
		
		var elementName =  "tableRow[" + row + "][" + j + "]";
		
		if (document.forms['ge_table'].elements[elementName])
		{
			if (arrGroup[j] == '')
			{
				arrGroup[j] ='-';
			}
   	 	document.forms['ge_table'].elements[elementName].value = arrGroup[j];
		}
		else
		{
   	 	alert('The copy area and paste area are not the same size and shape.');	
		return;
		}
		

	
		}
			
		var row = row + 1;

    }
 }