var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

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];}
}
//
// Functions for Popup
//
function PopUp1(theURL,winName) { 
	features ='status=no, resizable=no, scrollbars=no ,width=665,height=375';
	if(window.screen){
		var left = (screen.width-665)/2;
		var top = (screen.height-375)/2;
		features+=',left='+left+',top='+top;
	}
	window.open(theURL,winName,features);
}

function PopUp2(theURL,winName) { 
	features ='status=no, resizable=no, scrollbars=yes, width=680, height=375';
	if(window.screen){
		var left = (screen.width-680)/2;
		var top = (screen.height-375)/2;
		features+=',left='+left+',top='+top;
	}
	window.open(theURL,winName,features);
}
function PopUp3(theURL,winName) { 
	features ='status=no, resizable=no, scrollbars=no ,width=640,height=600';
	if(window.screen){
		var left = (screen.width-680)/2;
		var top = (screen.height-600)/2;
		features+=',left='+left+',top='+top;
	}
	window.open(theURL,winName,features);
}
function PopUp4(theURL,winName) { 
	features ='status=no, resizable=no, scrollbars=no ,width=500,height=405';
	if(window.screen){
		var left = (screen.width-600)/2;
		var top = (screen.height-600)/2;
		features+=',left='+left+',top='+top;
	}
	window.open(theURL,winName,features);
}
function PopUp5(theURL,winName) { 
	features ='status=no, resizable=no, scrollbars=yes ,width=660,height=600';
	if(window.screen){
		var left = (screen.width-740)/2;
		var top = (screen.height-600)/2;
		features+=',left='+left+',top='+top;
	}
	window.open(theURL,winName,features);
}
function activateSection(section) 
{ 
var sectionID;
sectionID = section.id;
var oSectionContent;
oSectionContent = eval('document.all.' + sectionID + '_content'); 

var oSectionImage; 
oSectionImage = eval('document.all.' + sectionID + '_image');

if (oSectionContent.style.display == 'none') 
{
oSectionImage.src = "images/minus.gif"; 
oSectionContent.style.display = ''; 
} 
else 
{ 
oSectionImage.src = "images/plus.gif"; 
oSectionContent.style.display = 'none'; 
} 
event.cancelBubble = false;
}

// For Expandable Sections
 		ddaccordion.init({
		headerclass: "expfunction", //Shared CSS class name of headers group
		contentclass: "expcontent", //Shared CSS class name of contents group
		collapseprev: false, //Collapse previous content (so only one open at any time)? true/false
		defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]
		animatedefault: false, //Should contents open by default be animated into view?
		persiststate: false, //persist state of opened contents within browser session?
		toggleclass: ["closedcontent", "opencontent"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
		togglehtml: ["prefix", "<img src='images/plus.gif' align='absmiddle' /> ", "<img src='images/minus.gif' align='absmiddle' /> "], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
		animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
		})
		
// For Expandable Sections
 		ddaccordion.init({
		headerclass: "expfunction2", //Shared CSS class name of headers group
		contentclass: "expcontent2", //Shared CSS class name of contents group
		collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
		defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]
		animatedefault: true, //Should contents open by default be animated into view?
		persiststate: false, //persist state of opened contents within browser session?
		toggleclass: ["closedcontent2", "opencontent2"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
		togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
		animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
		})

// Tips when mouse over hyperlink

window.addEvent('domready', function(){

	/* Tips 1 */
	var Tips1 = new Tips($$('.Tips1'));
	
	/* Tips 2 */
	var Tips2 = new Tips($$('.Tips2'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
	
	/* Tips 3 */
	var Tips3 = new Tips($$('.Tips3'), {
		showDelay: 400,
		hideDelay: 400,
		fixed: true
	});
	
	/* Tips 4 */
	var Tips4 = new Tips($$('.Tips4'), {
		className: 'custom'
	});
	
	/*Tips 5 */
	var Tips4 = new Tips($$('.Tips5'), {
		className: 'custom2'

	});
}); 

// AJAX Page Loader

    var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname
    var bustcacheparameter=""
    
    function ajaxpage(url, containerid){
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    } 
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e){}
    }
    }
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    if (bustcachevar) //if bust caching of external page
    bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
    page_request.open('GET', url+bustcacheparameter, true)
    page_request.send(null)
    }
    
    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=page_request.responseText
    }
    
    function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    }
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    }
    }
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appendChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    }
    }
    }