<!--
function togglecontent(id)
{

	classname=id;
	var obj=document.getElementById(classname);
	
	if (obj.style.display=='block') {
		obj.style.display='none';
	}
	else {
		obj.style.display='block';
	}
}

function togglecontent2(id)
{

	classname=id;
	var obj=document.getElementById(classname);
	
	if (obj.style.display=='block') {
		obj.style.display='none';
		document.getElementsByName(id+'_icon')[0].src="/images/expand16.gif";
	}
	else {
		obj.style.display='block';
		document.getElementsByName(id+'_icon')[0].src="/images/collapse16.gif";
	}
}

function showcontent(id, height, width)
{
	classname=id;
	var obj=document.getElementById(classname);
	if (((window.height===undefined) || (height<10)) && height!=-1) {
		var height = 450;
	}
	if (((window.width===undefined) || (width<10)) && width!=-1) {
		var width = 600;
	}
	
	obj.style.display='block';
	obj.style.height=height;
	obj.style.width=width;
}

function hidecontent(id)
{
	classname=id;
	var obj=document.getElementById(classname);
	obj.style.height=10;
	obj.style.width=10;
	obj.style.display='none';
}

function removecontent(id)
{
	classname=id;
	var obj=document.getElementById(classname);
	obj.innerHTML='';
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function text_replace(str, fnd, rplc) {
	while (str.indexOf(fnd,0)>0) {
		str=str.replace(fnd,rplc);
	}
	return str;
}


function addslashes(str, replaceLF) {

if (replaceLF>0) {
	str=str.replace(String.fromCharCode(10),'<br>');
}


str=str.replace(/\'/g,'\\\'');
str=str.replace(/\"/g,'\\"');
str=str.replace(/\\/g,'\\\\');
str=str.replace(/\0/g,'\\0');

str=text_replace(str, '#', '%23');
//str=text_replace(str, '&amp;', '%26');
//str=text_replace(str, '&', '%26');

return str;
}

function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\\\/g,'\\');
str=str.replace(/\\0/g,'\0');
str=str.replace('amp;','');
return str;
}

function html_entity_decode(str) {
  var ta=document.createElement("textarea");
  ta.innerHTML=str.replace("amp;","");
  return ta.value;
}

var timer;
    function delayGetData(type, id, target, val1, val2, val3, val4, height, width){

       clearTimeout(timer);
       timer=setTimeout("ajaxGetData(type, id, target, val1, val2, val3, val4, height, width)",500);
    }

    function delayFormSubmit(type, id, target, val1, val2, val3){

       clearTimeout(timer);
       timer=setTimeout(ajaxFormSubmit(type, id, target, val1, val2, val3),500);
    }


function ajaxGetData(type, id, target, val1, val2, val3, val4, height, width)
  {
  //var xmlHttp;
  
  switch(type) {

  case 'editdisplay':
  case 'getObjectProperty':
	  	url="ajaxCalls.php?type="+type+"&objectID="+id+"&objecttype="+val1+"&property="+val2;
		break;
		
  case 'outputScreen':
	  	url="ajaxCalls.php?type="+type+"&objectID="+id+"&objecttype="+val1+"&scrnname="+val2+val3;
		break;
		
  default:
		url="ajaxCalls.php?type="+type+"&id="+id+"&val1="+val1+"&val2="+val2;
		break;
  } // end switch type

//alert(url);

  try
	{
	// Firefox, Opera 8.0+, Safari
  		window.xmlHttp=new XMLHttpRequest();
	}
  catch (e)
	{
	// Internet Explorer
	try
	  {
	  window.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	catch (e)
	  {
	  try
		{
		window.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  catch (e)
		{
		alert("Your browser does not support AJAX!");
		return false;
		}
	  }
	}

	window.xmlHttp.onreadystatechange=function()
	  {
	  if(window.xmlHttp.readyState==4)
		{

		var content = stripslashes(window.xmlHttp.responseText.replace("amp;",""));		
		document.getElementById(target).innerHTML=content;
//		alert(content);
		//hidecontent('loading');
				
		// call ajax to update the child properties
		  if (target == "popup") {
			showcontent('popup', height, width);
		  }
		  if (target == "popup") {
			showcontent('popup', height, width);
		  }
		  if (type == "addSectionRegistrationPost") {
			window.location.reload();
		  }
		  
		  $(".ajaxpopup").fancybox();

		}
	  }

		
	//showcontent('loading');
		
	window.xmlHttp.open("GET",url,true);

	window.xmlHttp.send(null);
}

function ajaxFormSubmit (type, id, target, val1, val2, val3)
  {

  //var xmlHttp;
		//showcontent('loading');

  // build variable string from form
    var query = ""; 
    // get form
    var frm = document.getElementById(id);
    for(var e=0; e<frm.elements.length; e++) {
    	//alert(frm.elements[e].name+"::"+frm.elements[e].type);
    	switch (frm.elements[e].type) {
    		case 'hidden':
    		case 'text':
    		case 'textarea':
    			query = query + "&" + frm.elements[e].name + "=" + escape(frm.elements[e].value),1;
    			break;
    		case 'checkbox':
    			if (frm.elements[e].checked) {
    				query = query + "&" + frm.elements[e].name + "=1";
    			}
    			break;
    		case 'select':
    		case 'select-one':
	    		//alert("in select:"+frm.elements[e].name)
			    for(var x=0; x< frm.elements[e].options.length; x++) {
					if(frm.elements[e].options[x].selected == true) {
					    query = query + "&" + frm.elements[e].name + "=" + escape(frm.elements[e].options[x].value); 
					}
			    }
    		case "radio":
    			if (frm.elements[e].checked) {
    				query = query + "&" + frm.elements[e].name + "=" + escape(frm.elements[e].value);
    			}
    			break;
    	}
    
    }
    //query = query.substring(1);
//alert(query);
    
  switch(type) {
	default:
	url="ajaxCalls.php?type="+type+query;
	break;
  } // end switch type


//alert (url);

  try
	{
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
	}
  catch (e)
	{
	// Internet Explorer
	try
	  {
		window.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	catch (e)
	  {
	  try
		{
		  window.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  catch (e)
		{
		alert("Your browser does not support AJAX!");
		return false;
		}
	  }
	}

  window.xmlHttp.onreadystatechange=function()
	  {
	  if(window.xmlHttp.readyState==4)
		{
		document.getElementById(target).innerHTML=stripslashes(window.xmlHttp.responseText.replace("amp;",""));
		
		//hidecontent('loading');
		
		// call ajax to update the child properties
		  if (type == "postedit") {
			if (window.xmlHttp.responseText.indexOf("<response>SUCCESS</response>")>=0) {
				hidecontent('popup');
				//hidecontent('fancybox-wrap');
				//hidecontent('fancybox-overlay');
			}
		  }
		  if (type == "childaddsectionapp") {
			// reload applications
			window.location.reload();
		  }
		  if (type == 'editpost') {
				//hidecontent('fancybox-wrap');
				//hidecontent('fancybox-overlay');
				hidecontent('popup');
				//alert(val1+val2+val3+'_value');
				//$.fancybox({'href':'ajaxCalls.php?type=quickView&val1=Family&id=5306'});
				//ajaxGetData('getObjectProperty', val3, val1+val2+val3+'_value', val1, val2);
				window.location.reload();
		  }
		  
		  if (target=="popupwide") {
		  	showcontent(target, 600, 800);
		  }
		  if (type=="edittagpost") {
		  	//alert(query);
		  	//alert(url);
		  }
			$(".ajaxpopup").fancybox();

		}
	  }

		
	//showcontent('loading');
		
  window.xmlHttp.open("GET",url,true);

  window.xmlHttp.send(null);
}

function bindFancybox() {
	$(document).ready(function() {

		$(".ajaxpopup").fancybox();

	});
	$(document).ajaxStop(function() {

		$(".ajaxpopup").fancybox();

	});
	
	$("#sendEmailForm").ajaxForm({
		target: '#composeemail'
    }); 
	$("#selectEmailForm").ajaxForm({
		target: '#composeemail'
    }); 

}

-->
