function flash(name, width, height, align)
{
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + width + '" height="' + height + '" id="' + name + '" align="' + align + '">');
    document.write('<param name="allowScriptAccess" value="sameDomain" />');
    document.write('<param name="movie" value="flash/' + name + '.swf" />');
    document.write('<param name="quality" value="high" />');
    document.write('<param name="bgcolor" value="#000000" />');
    document.write('<param name="salign" value="lt" />');
    document.write('<param name=wmode value="transparent" />');
    document.write('<embed play=false swliveconnect="true" src="flash/' + name + '.swf" quality="high" wmode=transparent bgcolor="#000000" width="' + width + '" height="' + height + '" name="' + name + '" salign="lt" align="' + align + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
    //alert('hi' + name);
}

function popUp(source, width, height)
 {
	if (width == "regular") {
		window.open(source, "popUp", "height=600,width=800,toolbar=no,scrollbars=yes,menubar=no,resizable=yes,location=yes");
    } else {
		window.open(source, "popUp", "height=" + height + ",width=" + width + ",toolbar=no,scrollbars=yes,menubar=no,resizable=yes");
	}
}              
                           
//	SendDataToFlashMovie("preview","url",img);
function SendDataToFlashMovie(movie,fl_variable,data)
{
     var flashMovie=getFlashMovieObject(movie);
     flashMovie.SetVariable("/:" + fl_variable, data);
     if (fl_variable == "url") {
	     //trigger loadMovie(url)
	     flashMovie.Play();
     }
}


function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}




function syncNav(href) {

        win = window.open(href, "syncNav");

}

//Author only AJAX (depricate, or make universal)
function cache(caller) {
    cached_caller = new Array();
    
    cached_caller["name"] = caller.name;
    cached_caller["value"] = caller.value;
}

function ajax(caller) {

     if (cached_caller.name == caller.name && cached_caller.value != caller.value) {
    
        var xmlHttp;
        try
          {
          // Firefox, Opera 8.0+, Safari
          xmlHttp=new XMLHttpRequest();
          }
        catch (e)
          {
          // Internet Explorer
          try
            {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
          catch (e)
            {
            try
              {
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
              }
            catch (e)
              {
              alert("Your browser does not support AJAX!");
              return false;
              }
            }
          }
          xmlHttp.onreadystatechange=function()
            {
            if(xmlHttp.readyState==4)
              {
              //show result:
          
                  document.getElementById(caller.name + ".status").innerHTML = xmlHttp.responseText;
              
                  if (caller.name == "change:child_name") {
                        child_name = caller.value;
                  }
              }
          }
          
          
          //xmlHttp.open("GET","portal.php?me=" + me + "&child=" + child + "&child_name=" + child_name + "&" + caller.name + "=" + escape(caller.value),true);
          //xmlHttp.send(null);
          
          
            var url = "portal.php";
            var params = "me=" + me + "&my_name=" + my_name + "&child=" + child + "&child_name=" + child_name + "&parent_name=" + parent_name + "&" + caller.name + "=" +caller.value;
            xmlHttp.open("POST", url, true);

            //Send the proper header information along with the request
            xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlHttp.setRequestHeader("Content-length", params.length);
            xmlHttp.setRequestHeader("Connection", "close");
            xmlHttp.send(params);
          
     }
}