/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if(typeof(lastBranchIndex)=='undefined'){
//var lastBranchIndex = 0;
}

function jHideDiv(divId){
//alert(document.getElementById(divId).innerHTML);
$(divId).hide();
	
}


function addBranchRows(){
//alert(lastBranchIndex);
//return;
		$("#officeBranches div.branchDiv:last").clone(true).insertAfter("#officeBranches div.branchDiv:last");

		nextBranchIndex= lastBranchIndex+1;
		branchDivId = "branchChild"+nextBranchIndex;
		$("#officeBranches div.branchDiv:last").id = branchDivId;

		$("#officeBranches div.branchDiv:last").find('input').each(function() {

			 this.name = this.name.replace('['+lastBranchIndex +']','['+nextBranchIndex +']');
			 this.value=null;

		});
		$("#officeBranches div.branchDiv:last").find('select').each(function() {

			 this.name = this.name.replace('['+lastBranchIndex +']','['+nextBranchIndex +']');
			 this.value=this.name;

		});
		lastBranchIndex++;
}

function jqShowMsg(msg){
	alert(msg);
}

function jqSplitString (stringToSplit,separator) {
   arrayOfStrings = stringToSplit.split(separator);
   return arrayOfStrings;
}

function updateCategorySelections(){
		categoryString ='';
		$('#RegisterDisplaySubCategories option').each(function(){
			selectedSubCategories[this.value] = 1;
			categoryString  = categoryString+this.value +',';
		})
		$('#RegisterSelectedSubCategoryId').attr('value',categoryString);
}

function updateCategorySelections2(){
		categoryString ='';
		$('#CompanyDisplaySubCategories option').each(function(){
			selectedSubCategories[this.value] = 1;
			categoryString  = categoryString+this.value +',';
		})
		$('#CompanySelectedSubCategoryId').attr('value',categoryString);
}

