/* OPEN POPUP AND FOCUS */
function getId(objectId){if(document.all && !document.getElementById){return document.all(objectId)}else{return document.getElementById(objectId)}}

function openPopupFocus(theURL,winName,features) {
	if ((document.all||document.getElementById) && screen.availWidth > 800){
		features = 'scrollbars=yes,resizable=yes,width='+(screen.availWidth-100)+',height='+(screen.availHeight-100);
	}else if (document.layers||document.getElementById){
		if (screen.availWidth>800){
    		features = 'scrollbars=yes,resizable=yes,width='+(screen.availWidth-100)+',height='+(screen.availHeight-100);
		}
	}
	newwindow=window.open(theURL,winName,features);
	newwindow.moveTo(50,50);
	if (window.focus) {newwindow.focus()}
	return false;
}

/* DREAMWEAVER STUFF */
function goToURL() {
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


// read + more  - less function
function toogleDisplay(elem,myDisplay){
	var Pcontainer=elem.parentNode.parentNode;
	var subParag = Pcontainer.getElementsByTagName('span')[2];
	subParag.style.display = myDisplay;
	subParag.style.borderLeft = "1px dashed #999";
	subParag.style.paddingLeft = "10px";
	subParag.style.marginTop = "3px";
	var myElem=elem.parentNode;
	if(myDisplay=='block'){
		myElem.innerHTML='<a href="javascript:;" onClick="toogleDisplay(this,\'none\')" class="noWrap">&#8212; less</a>';
	}else{
		myElem.innerHTML='<a href="javascript:;" onClick="toogleDisplay(this,\'block\')" class="noWrap">+ more...</a>';	
	}
}

// function to resize flv player at runtime (the function is called from flav_player.swf)
theWidth = 400
theHeight = 300
function resizeFlash(myWidth,myHeight){
	theWidth = myWidth;
	theHeight = myHeight;
	if(getId("duo")){
		var duoDiv = getId("duo");
		if((myWidth*1) > 400){
			duoDiv.style.width = "550px";
			duoDiv.style.marginLeft = "0px";
		}
	}
	if(getId("flashMovie")){
		var flashDiv = getId("flashMovie");
		flashDiv.setAttribute("width",myWidth);
		flashDiv.setAttribute("height",myHeight);
	}
	//alert(myWidth+'-'+myHeight);
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
