// JavaScript Document

function InsertFlashObject(fileLocation,width,height, color)
{
	var vmode;
	var colorWrite;
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+ width +"' height='"+ height +"'>");
    document.write("<param name='movie' value='"+ fileLocation +"'>");
    document.write("<param name='quality' value='high'>");
	if (color == 'none'){
	document.write("<param name='wmode' value='transparent'>");
	vmode = "wmode='transparent'";
	colorWrite = ""
	}else{
	document.write("<param name='bgcolor' value='#"+ color +"'>");
	colorWrite = "bgcolor='#"+ color +"'";
	}
	document.write("<param name='menu' value='false'>");
    document.write("<embed src='"+ fileLocation +"' quality='high' pluginspage='https://www.macromedia.com/go/getflashplayer' " + vmode + " type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"' " + colorWrite + "></embed>");
	document.write("</object>");
}


var Lst;

function CngClass(obj){
	if (typeof(obj)=='string') obj=document.getElementById(obj);
	if (Lst) Lst.className='';
	obj.className='selected';
	Lst=obj;
}

function hideEventsNews() {
document.getElementById("recentNews").style.display = "none";	
document.getElementById("recentEvents").style.display = "none";	
}

function clearSearch(){
	if (document.getElementById('search').value == 'Search') {
		document.getElementById('search').value = '';	
	}
}

function addSearch(){
	if (document.getElementById('search').value == '') {
		document.getElementById('search').value = 'Search';	
	}
}

function disableEnterKey(e)
{
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     
	 if (key == 13) {
	 	document.getElementById("btnSearch").click();
		return (key != 13);
	 }else{
     	return (key != 13);
	 }
}

function GoogleSearch (form,thiswidth,GoogleCSEID) 
{
    var TestVar = form.search.value;
	var newloc = "/googlesearch.aspx?cx=" + GoogleCSEID + "&cof=FORID%3A11&ie=UTF-8&Width=" + thiswidth + "&q=" + TestVar;
	document.location.href = newloc;
}



var xmlhttp;
var ajaxDivId;
function ajaxRequest(url,divId){
	xmlhttp=null;
	ajaxDivId = divId
	if (window.XMLHttpRequest)
	{// code for Firefox, Opera, IE7, etc.
	xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{// code for IE6, IE5
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp!=null)
	{
	xmlhttp.onreadystatechange = state_Change;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	}
	else
	{
	alert("Your browser does not support XMLHTTP.");
	}
}

function state_Change(){
	if (xmlhttp.readyState==4)
	{// 4 = "loaded"
	if (xmlhttp.status==200)
	{// 200 = "OK"
	document.getElementById(ajaxDivId).innerHTML=xmlhttp.responseText;
	}
	else
	{
	alert("Problem retrieving data:" + xmlhttp.statusText);
	}
	}
}


var milliseconds = 6000;
var i=2;
var int;
var old=1;
function rotate(spec, numRotates){
	if (spec != old){
		if(spec!=null){
			i=spec;
			control(0);
		};
		if(old!=spec){
			jQuery2('#' + old).animate({'left':'-=695px'});
			//jQuery2('#' + old).fadeOut();
			jQuery2('#img' + old).attr({'class':''});
			document.getElementById(old + 'l').style.backgroundColor = ''; 
			document.getElementById(old + 'l').style.color ='';
		}
		document.getElementById(i).style.left = "705px";
		document.getElementById(i + 'l').style.color ='#FFF';
		jQuery2('#' + i).animate({'left':'-=705px'});
		//jQuery2('#' + i).fadeIn();
		jQuery2('#img' + i).attr({'class':'img1'});
		old=i;
		i++;
		if (numRotates==null){
			numRotates=3
		}
		if(i>numRotates)i=1;
	}
};
function control(op){
	if(!op){
		clearInterval(int);
	}
	else{
		int = setInterval('rotate()', milliseconds);
	};
};

jQuery2(document).ready(function ()
{jQuery2("iframe").each(function()
{var url = jQuery2(this).attr("src");
var result = url.search(/youtube/i);
if(result!=-1)
{result = url.indexOf("?");
if(result!=-1)
{jQuery2(this).attr("src",url+"&wmode=transparent");
} else {jQuery2(this).attr("src",url+"?wmode=transparent");}
}
});
});




