function WritePlayer(container, id, file) 
{
	document.getElementById(container).innerHTML = 
	    "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='17' height='17' id='" +
	        id + "' data='/resources/musicplayer.swf?song_url=/resources/voices/" + file + "' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='/resources/musicplayer.swf?song_url=/resources/voices/" + file + 
	        "' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='/resources/musicplayer.swf?song_url=/resources/voices/" + 
	        file + "' quality='high' bgcolor='#ffffff' width='17' height='17' name='" + id + 
	        "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}


function WriteFlashObj(container, id, flashFile, width, height)
{
	document.getElementById(container).innerHTML = 
	    "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='" + width + "' height='" + height + "' id='" +
	        id + "' data='" + flashFile + "' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='" + flashFile + 
	        "' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='" + 
	        flashFile + "' quality='high' bgcolor='#ffffff' width='" + width + "' height='" + height + "' name='" + id + 
	        "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}


function SetCookie(name, value, isSession) 
{
	var expDate = new Date();
	expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000 * 365)); 
	
	var newCookie = name + "=" + value + "; path=/; "
	if (isSession == false)
		newCookie += "expires=" + expDate.toGMTString();
	document.cookie = newCookie;
}




function GetCookie(name) 
{
	var allCookies = String(document.cookie);	
	var cookieStart = allCookies.indexOf(name);
	if(cookieStart != -1) 
	{
		cookieStart = cookieStart + name.length + 1;
		var cookieEnd = allCookies.indexOf(";", cookieStart);
		if(cookieEnd == -1) 
		{
		    cookieEnd = allCookies.length;
		}
		return allCookies.substring(cookieStart, cookieEnd);
	} 
	else 
	{
		return false;
	}
}




function printarticle(lngId)
{
	strWin = window.open ("/printarticle.php?id=" + lngId , "_blank", "toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=500");
}

//sfHover = function() {
//	var navEl = document.getElementById("nav");
//	if (navEl != null)
//	{
//		var sfEls = navEl.getElementsByTagName("LI");
//		for (var i=0; i<sfEls.length; i++) {
//			sfEls[i].onmouseover=function() {
//				this.className+=" sfhover";
//			}
//			sfEls[i].onmouseout=function() {
//				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
//			}
//		}
//	}
//}
//if (window.attachEvent) window.attachEvent("onload", sfHover);


function SwitchImg(imgName, over)
{
	fld = document.getElementById (imgName + "img");
	eval ("fld.src = img" + imgName + (over ? "over" : "off") +".src;");
	//fld.src = "/_structure/images/system/" + imgName + (over ? "over" : "off") + ".jpg";
}





function GetWindowSize(getWidth) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth + ', Height = ' + myHeight);
  if (getWidth) 
    return myWidth
  else
    return myHeight
  
}




function FindPosX(obj)
{
    var curleft = 0;
    if(obj.offsetParent)
    {
        while(1) 
        {
            curleft += obj.offsetLeft;
            if(!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    }
    else if(obj.x)
    {
        curleft += obj.x;
    }
    return curleft;
}




function FindPosY(obj)
{
    var curtop = 0;
    if(obj.offsetParent)
    {
        while(1)
        {
            curtop += obj.offsetTop;
            if(!obj.offsetParent)
                break;
            obj = obj.offsetParent;
        }
    }
    else if(obj.y)
    {
        curtop += obj.y;
    }
    return curtop;
}



function FindHeight(obj)
{
    return (obj.offsetHeight);
}



function FindWidth(obj)
{
    return (obj.offsetWidth);
}


function InsertAtCursor(fld, val) 
{
	if (document.selection) 
	{
		//ie support
		fld.focus();
		sel = document.selection.createRange();
		sel.text = val;
	}
	else if (fld.selectionStart || fld.selectionStart == "0") 
	{
		//moz/netscape support
		var startPos = fld.selectionStart;
		var endPos = fld.selectionEnd;
		fld.value = fld.value.substring(0, startPos) + val + fld.value.substring(endPos, fld.value.length);
	} 
	else 
	{
		fld.value += val;
	}
}


function HideMsg(type)
{
    var msg = document.getElementById(type);
    msg.style.display = "none";
}

function AddToFavourites(dispName, url)
{
    /* Firefox support*/
    if (window.sidebar) 
    {
        window.sidebar.addPanel(dispName, url, "");
    }
    /* opera support */
    else if(window.opera && window.print)
    { 
        var anchor = document.createElement('a');
        anchor.setAttribute('href',url);
        anchor.setAttribute('title',dispName);
        anchor.setAttribute('rel','sidebar');
        anchor.click();
    }
    /* Internet Explorer */
    else if(document.all)
    {
    	window.external.AddFavorite(url, dispName);
    }
    /* Unsupported */
    else
    {
        alert ("Unfortunately your browser does not support this feature.");
    }
    
}


function mtf(e)
{
	var p = '\u006d\u0061\u0069\u006c\u0074\u006f\u003a';
	void(top.location = p + e);
	return false;
}

function dn()
{
}

function ShowImg(obj)
{
	obj.style.display = 'block';
//	var parent = obj.parentNode;
//	if (parent != null)
//	{
//	    parent.style.visibility = 'visible';
//	    parent.parentNode.style.visibility = 'visible';
//	}
}
