//ajax  review function
var http_request = false;
   function school_reviews_post(url, parameters) {
    parameters=parameters.replace(/&%/g,"%26%")
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = school_reviews_alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function school_reviews_alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('school_reviews_submit_span').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
//end reviews ajax function


//ajax alumni function
var http_request = false;
   function alumni_post(url, parameters) {
    parameters=parameters.replace(/&%/g,"%26%")
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alumni_alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
function alumni_alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('alumni_submit_span').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
  //end alumni ajax function
  
  //ajax calendar function
var http_request = false;
   function calendar_post(url, parameters) {
    parameters=parameters.replace(/&%/g,"%26%")
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = calendar_alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
function calendar_alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('calendar_submit_span').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
  //end calendar ajax function

//ajax email function
var http_request = false;
   function email_post(url, parameters) {
    parameters=parameters.replace(/&%/g,"%26%")
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = email_alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
function email_alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('school_email_submit_span').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
  //end email ajax function


//rating functions
function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
function $S(o) { return((typeof(o)=='object'?o:$(o)).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:$(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.documentElement.scrollLeft,'Y':event.clientY+document.documentElement.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }

star={};

star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;

	document.onmousemove=function(e) { var n=star.num;
	
		var p=abPos($('star'+n)), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);

		if(oX<1 || oX>170 || oY<0 || oY>40) { star.stop=1; star.revert(); }
		
		else {

			$S('starCur'+n).width=oX+'px';
			$S('starUser'+n).color='#FF0000';
			$('starUser'+n).innerHTML=Math.round(oX/170*5)+' / 5 Rating';
		}
	};
} };
star.update=function(e,o) { var n=star.num, v=parseInt($('starUser'+n).innerHTML);
document.forms['school_reviews_form'].elements['school_review_rating'].value = v
n=o.id.substr(4); $('starCur'+n).title=v;
	req=new XMLHttpRequest(); req.open('GET','?vote='+(v/100),false); req.send(null);
};

star.revert=function() { var n=star.num, v=parseInt($('starCur'+n).title);
	$S('starCur'+n).width=Math.round(v*34)+'px';
	$('starUser'+n).innerHTML=(v>0?Math.round(v)+' / 5 Rating':'');
	$('starUser'+n).style.color='#666';
	
	document.onmousemove='';
};
star.num=0;
//end rating function

//confirm flag function
function confirmflag(flag) {
  if (confirm('Are You Sure You Would Like To Flag As Inappropriate?')) {
    document.location = flag;
  }
}
// end confirm delete function

//preview bubble
/*
    WebSnapr - Preview Bubble Javascript
    Written by Juan Xavier Larrea 
    http://www.websnapr.com
    last modified: Aug 2007, mo
*/

// Point this variable to the correct location of the bg.png file
var bubbleImagePath = '/images/template_images/bg.png';

// DO NOT EDIT BENEATH THIS
if(typeof Array.prototype.push!="function"){
Array.prototype.push=ArrayPush;
function ArrayPush(_1){
this[this.length]=_1;
}
}
function WSR_getElementsByClassName(_2,_3,_4){
var _5=(_3=="*"&&_2.all)?_2.all:_2.getElementsByTagName(_3);
var _6=new Array();
_4=_4.replace(/\-/g,"\\-");
var _7=new RegExp("(^|\\s)"+_4+"(\\s|$)");
var _8;
for(var i=0;i<_5.length;i++){
_8=_5[i];
if(_7.test(_8.className)){
_6.push(_8);
}
}
return (_6);
}
function bindBubbles(e){
lbActions=WSR_getElementsByClassName(document,"a","previewlink");
for(i=0;i<lbActions.length;i++){
if(window.addEventListener){
lbActions[i].addEventListener("mouseover",attachBubble,false);
lbActions[i].addEventListener("mouseout",detachBubble,false);
}else{
lbActions[i].attachEvent("onmouseover",attachBubble);
lbActions[i].attachEvent("onmouseout",detachBubble);
}
}
}
function attachBubble(_b){
var _c;
if(_b["srcElement"]){
	_c=_b["srcElement"];
}else{
	_c=_b["target"];
}
if (_c.id == undefined){
	_c=_c.parentNode;
}
var _d=_c.id;
var _e=findPos(_c)[0]+5;
var _f=findPos(_c)[1]+17;
var _10=document.createElement("div");
document.getElementsByTagName("body")[0].appendChild(_10);
_10.className="previewbubble";
if (BrowserDetect.browser == 'Explorer') {
_10.style.width="240px";
_10.style.position="absolute";
_10.style.top=_f;
_10.style.zIndex=99999;
_10.style.left=_e;
_10.style.textAlign="left";
_10.style.height="190px";
_10.style.paddingTop="0";
_10.style.paddingLeft="0";
_10.style.paddingBottom="0";
_10.style.paddingRight="0";
_10.style.marginTop="0";
_10.style.marginLeft="0";
_10.style.marginBottom="0";
_10.style.marginRight="0";
_10.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bubbleImagePath + "',sizingMethod='image')";
} else {
_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+_f+"px ; left: "+_e+"px ; background: url("+ bubbleImagePath +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
}
if (BrowserDetect.browser == 'Safari' || BrowserDetect.browser == 'Konqueror' ) {

var _height = _f;
    
_10.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+ _height +"px ; left: "+_e+"px ; background: url("+ bubbleImagePath +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;");
    
}
var img=document.createElement("img");
_10.appendChild(img);

if (BrowserDetect.browser == 'Explorer') {
img.style.paddingTop="0";
img.style.paddingLeft="0";
img.style.paddingBottom="0";
img.style.paddingRight="0";
img.style.margin="auto";
img.style.marginTop="27px";
img.style.marginLeft="25px";
img.style.marginBottom="0";
img.style.marginRight="0";
img.style.borderTop="0";
img.style.borderLeft="0";
img.style.borderBottom="0";
img.style.borderRight="0";
} else {
img.setAttribute("style","padding-top: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; margin-top: 27px; margin-left: 12px; margin-bottom: 0; margin-right: 0; border: 0");
}

img.setAttribute("src",_d);
img.setAttribute("width",202);
img.setAttribute("height",152);
img.setAttribute("alt","Snapshot");



}
function detachBubble(_12){
lbActions=WSR_getElementsByClassName(document,"div","previewbubble");
for(i=0;i<lbActions.length;i++){
lbActions[i].parentNode.removeChild(lbActions[i]);
}
}
if(window.addEventListener){
addEventListener("load",bindBubbles,false);
}else{
attachEvent("onload",bindBubbles);
}
function findPos(obj){
var _14=curtop=0;
if(obj.offsetParent){
_14=obj.offsetLeft;
curtop=obj.offsetTop;
while(obj=obj.offsetParent){
_14+=obj.offsetLeft;
curtop+=obj.offsetTop;
}
}
return [_14,curtop];
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},	
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},

		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]
};
BrowserDetect.init();
//end preview bubble
