function GetIEVersion()
{
var r="0.0", sigIEStart="MSIE ", sigIEEnd=";", k, l;
	k = navigator.appVersion.indexOf(sigIEStart);
	if(k!=-1)
	{
		l = navigator.appVersion.indexOf(sigIEEnd,k);
		if(l!=-1)
			r = navigator.appVersion.substring(k+sigIEStart.length,l);
	}
	return r;
}

function safeBlankWindow(sFeatures)
{
var tmpurl='';
	if(document.all) //?? double escapes problematic
		if(GetIEVersion()>="5.5" && location.search.search(/%25[0-9a-f]{2}/gi)!=-1)
			tmpurl = '/images/clearpixel.gif';
	return window.open(tmpurl,'_blank',sFeatures);
}

function mm(url,w,h)
{
var features = 'toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,width=' + w + ',height=' + h;

	if(url!='')
		return window.open(url,'_blank',features);
	else
		return safeBlankWindow(features);
}

function openlink(url,w,h)
{
var features = 'width=' + w + ',height=' + h;

	if(url!='')
		return window.open(url,'_blank',features);
	else
		return safeBlankWindow(features);
}

function openlink1(url,w,h)
{
var features = 'toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,width=' + w + ',height=' + h;

	if(url!='')
		return window.open(url,'_blank',features);
	else
		return safeBlankWindow(features);
}

function startmovie()
{
var doc;
var moviestr;
var url;

		
	moviestr = this.template.replace(/<<OBJECTWIDTH>>/gi,this.objw);
	moviestr = moviestr.replace(/<<OBJECTHEIGHT>>/gi,this.objh);
	moviestr = moviestr.replace(/<<EMBEDWIDTH>>/gi,this.embw);
	moviestr = moviestr.replace(/<<EMBEDHEIGHT>>/gi,this.embh);
	moviestr = moviestr.replace(/<<FILEURL>>/gi,this.url);

	doc = mm('',this.winw,this.winh).document;

	doc.open("text/html");

	if(document.all)
		doc.charset=document.charset;
	else
		doc.characterset=document.characterset;

	//STRING LITERAL//
	doc.write("<HTML><HEAD><TITLE>neura.net</TITLE></HEAD><BODY marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 bgcolor='#6699CC'>");
	doc.write("<TABLE><TR><TD><FONT face='Verdana, Tahoma, Arial' color='#FFFFFF' size=2>"+this.title+"</FONT></TD></TR><TR><TD>");
	doc.write(moviestr);
	doc.write("</TD></TR></TABLE></BODY></HTML>");

	doc.close();
}

function mediaplayer(url,title,w,h)
{
var sdattrib,sdparam;

	if(h<50)
	{
		sdattrib = " ShowDisplay='0' ";
		sdparam = "<PARAM NAME='ShowDisplay' VALUE='0'>";
	}
	else
	{
		sdattrib = "";
		sdparam = "";
	}

	this.objw =w+0;
	this.objh = h+50;
	this.embw=w+0;
	this.embh=h+0;
	this.winw=w+6;
	this.winh=h+92;
	this.url=url;
	this.title = title;
	this.start = startmovie;

	this.template="<OBJECT WIDTH=<<OBJECTWIDTH>> HEIGHT=<<OBJECTHEIGHT>> CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,2,902' TYPE='application/x-oleobject'>" +
		      sdparam + "<PARAM NAME='ShowControls' VALUE='1'><PARAM NAME='FileName' VALUE='<<FILEURL>>'><PARAM NAME='AutoStart' Value='1'><PARAM NAME='AnimationAtStart' VALUE=0><PARAM NAME='TransparentAtStart' VALUE='1'>" +
		      "<EMBED" + sdattrib + " WIDTH=<<EMBEDWIDTH>> HEIGHT=<<EMBEDHEIGHT>> TYPE='application/x-mplayer2' PLUGINSPAGE='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' FILENAME='<<FILEURL>>' SHOWCONTROLS=1 SHOWTRACKER=1 AUTOSTART=1></EMBED></OBJECT>";
}

function realplayer(url,title,w,h)
{
	this.objw =w+0;
	this.objh = h;
	this.embw=w+0;
	this.embh=h+0;
	this.winw=w+6;
	this.winh=h+72;
	this.url=url;
	this.title = title;
	this.start = startmovie;

	this.template="<OBJECT WIDTH=<<OBJECTWIDTH>> HEIGHT=<<OBJECTHEIGHT>> CLASSID='CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'>"+
		      "<PARAM NAME=SRC VALUE='<<FILEURL>>'><PARAM NAME=AUTOSTART VALUE=true><PARAM NAME=CONTROLS VALUE=ImageWindow><PARAM NAME=CONSOLE VALUE=c1>"+
		      "<EMBED TYPE='audio/x-pn-realaudio-plugin' SRC='<<FILEURL>>' WIDTH=<<EMBEDWIDTH>> HEIGHT=<<EMBEDHEIGHT>> AUTOSTART=true CONTROLS=ImageWindow CONSOLE=c1></EMBED></OBJECT><BR>"+
		      "<OBJECT WIDTH=<<OBJECTWIDTH>> HEIGHT=30 CLASSID='CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'>"+
		      "<PARAM NAME=CONTROLS VALUE=ControlPanel><PARAM NAME=AUTOSTART Value=true><PARAM NAME=CONSOLE VALUE=c1>"+
		      "<EMBED TYPE='audio/x-pn-realaudio-plugin' WIDTH=<<EMBEDWIDTH>> HEIGHT=30 CONTROLS=ControlPanel AUTOSTART=true CONSOLE=c1></EMBED></OBJECT>";
}

function shockwaveflash(url,title,w,h)
{
	this.objw =w+0;
	this.objh = h+0;
	this.embw=w+0;
	this.embh=h+0;
	this.winw=w+6;
	this.winh=h+42;
	this.url=url;
	this.title = title;
	this.start = startmovie;

	this.template="<OBJECT WIDTH=<<OBJECTWIDTH>> HEIGHT=<<OBJECTHEIGHT>> CLASSID='CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000' CODEBASE='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#3,0,0,0'>"+
		      "<PARAM NAME=SRC VALUE='<<FILEURL>>'>"+
		      "<EMBED SRC=<<FILEURL>> WIDTH=<<EMBEDWIDTH>> HEIGHT=<<EMBEDHEIGHT>> PLUGINSPAGE='http://www.macromedia.com/shockwave/download/' TYPE='application/x-shockwave-flash'></EMBED></OBJECT>";
}

function playmovie(url,title,w,h){
var player,fname,ext,i;

	fname = url.slice(url.lastIndexOf("/")+1);
	
	i=fname.lastIndexOf(".");

	if(i==-1) return;

	ext = fname.slice(i+1).toLowerCase();

	switch(ext)
	{
		case "ra":
		case "ram":
		case "rm":
				player = new realplayer(url,title,w,h);	
				break;
		case "swf":
				player = new shockwaveflash(url,title,w,h);
				break;
		default:
				player = new mediaplayer(url,title,w,h);
				break;
	}

	player.start();
}

function countPodCast(url,type)
{
var dt=new Date();
var im = new Image();
im.src = '/count.asp?type='+escape(type)+'&url='+escape(url)+'&t='+dt.getTime();
}

function playpodcast(url,title,w)
{
var doc,ll;
var moviestr="";
var winw=w+30,winh=250;


	countPodCast(url,1);

	ll = location.protocol+'//'+location.hostname;

	if(url.charAt(0)=="/") url=ll+url;

	moviestr = moviestr + "<OBJECT WIDTH='"+w+"' HEIGHT=45 CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,2,902' TYPE='application/x-oleobject'>"
	moviestr = moviestr + "<PARAM NAME='ShowDisplay' VALUE='0'>"
	moviestr = moviestr + "<PARAM NAME='ShowControls' VALUE='1'>"
	moviestr = moviestr + "<PARAM NAME='ShowTracker' VALUE='1'>"
	moviestr = moviestr + "<PARAM NAME='FileName' VALUE='"+url+"'>"
	moviestr = moviestr + "<PARAM NAME='AutoStart' Value='1'>"
	moviestr = moviestr + "<PARAM NAME='AnimationAtStart' VALUE=0>"
	moviestr = moviestr + "<PARAM NAME='TransparentAtStart' VALUE='1'>"
	moviestr = moviestr + "<EMBED WIDTH='"+w+"' HEIGHT=45 TYPE='application/x-mplayer2' PLUGINSPAGE='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' FILENAME='"+url+"' SHOWDISPLAY=0 SHOWCONTROLS=1 SHOWTRACKER=1 AUTOSTART=1></EMBED>"
	moviestr = moviestr + "</OBJECT>"

	doc = mm('',winw,winh).document;

	doc.open("text/html");

	if(document.all)
		doc.charset=document.charset;
	else
		doc.characterset=document.characterset;

	doc.write("<HTML><HEAD><TITLE>Neura.net</TITLE></HEAD><BODY marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 bgcolor='#ffffff'><TABLE border=0 cellpadding=0 cellspacing=0 align=center width='100%' height='100%'><TR><TD align=center valign=middle>");

	doc.write("<TABLE border=0 cellpadding=0 cellspacing=0 width='"+w+"'>");
	if(title!="")
		doc.write("<TR><TD align=center><FONT face='Georgia, Verdana, Tahoma, Arial, Helvetica' color='#f21513' size='2'><B>"+title+"</B></FONT><BR><IMG src='"+ll+"/images/spacer.gif' width=1 height=1></TD></TR>");
	doc.write("<TR><TD align=center><IMG width=150 height=150 border=0 src='"+ll+"/images/podcast/podcast_artwork3.jpg'></TD></TR>");
	doc.write("<TR><TD>"+moviestr+"</TD></TR>");
	doc.write("</TABLE>");

	doc.write("</TD></TR></TABLE></BODY></HTML>");

	doc.close();
}


function playpodcastPD(url,title,w)
{
var doc,ll;
var moviestr="";
var winw=w+30,winh=250;


	countPodCast(url,10);

	ll = location.protocol+'//'+location.hostname;

	if(url.charAt(0)=="/") url=ll+url;

	moviestr = moviestr + "<OBJECT WIDTH='"+w+"' HEIGHT=45 CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,2,902' TYPE='application/x-oleobject'>"
	moviestr = moviestr + "<PARAM NAME='ShowDisplay' VALUE='0'>"
	moviestr = moviestr + "<PARAM NAME='ShowControls' VALUE='1'>"
	moviestr = moviestr + "<PARAM NAME='ShowTracker' VALUE='1'>"
	moviestr = moviestr + "<PARAM NAME='FileName' VALUE='"+url+"'>"
	moviestr = moviestr + "<PARAM NAME='AutoStart' Value='1'>"
	moviestr = moviestr + "<PARAM NAME='AnimationAtStart' VALUE=0>"
	moviestr = moviestr + "<PARAM NAME='TransparentAtStart' VALUE='1'>"
	moviestr = moviestr + "<EMBED WIDTH='"+w+"' HEIGHT=45 TYPE='application/x-mplayer2' PLUGINSPAGE='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' FILENAME='"+url+"' SHOWDISPLAY=0 SHOWCONTROLS=1 SHOWTRACKER=1 AUTOSTART=1></EMBED>"
	moviestr = moviestr + "</OBJECT>"

	doc = mm('',winw,winh).document;

	doc.open("text/html");

	if(document.all)
		doc.charset=document.charset;
	else
		doc.characterset=document.characterset;

	doc.write("<HTML><HEAD><TITLE>Neura.net</TITLE></HEAD><BODY marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 bgcolor='#ffffff'><TABLE border=0 cellpadding=0 cellspacing=0 align=center width='100%' height='100%'><TR><TD align=center valign=middle>");

	doc.write("<TABLE border=0 cellpadding=0 cellspacing=0 width='"+w+"'>");
	if(title!="")
		doc.write("<TR><TD align=center><FONT face='Georgia, Verdana, Tahoma, Arial, Helvetica' color='#f21513' size='2'><B>"+title+"</B></FONT><BR><IMG src='"+ll+"/images/spacer.gif' width=1 height=1></TD></TR>");
	doc.write("<TR><TD align=center><IMG width=150 height=150 border=0 src='"+ll+"/images/podcast/podcast_artwork3.jpg'></TD></TR>");
	doc.write("<TR><TD>"+moviestr+"</TD></TR>");
	doc.write("</TABLE>");

	doc.write("</TD></TR></TABLE></BODY></HTML>");

	doc.close();
}

function playpodcastNoLogo(url,title,w)
{
var doc,ll;
var moviestr="";
var winw=w+30,winh=100;

	countPodCast(url,1);

	ll = location.protocol+'//'+location.hostname;

	if(url.charAt(0)=="/") url=ll+url;

	moviestr = moviestr + "<OBJECT WIDTH='"+w+"' HEIGHT=45 CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,2,902' TYPE='application/x-oleobject'>"
	moviestr = moviestr + "<PARAM NAME='ShowDisplay' VALUE='0'>"
	moviestr = moviestr + "<PARAM NAME='ShowControls' VALUE='1'>"
	moviestr = moviestr + "<PARAM NAME='ShowTracker' VALUE='1'>"
	moviestr = moviestr + "<PARAM NAME='FileName' VALUE='"+url+"'>"
	moviestr = moviestr + "<PARAM NAME='AutoStart' Value='1'>"
	moviestr = moviestr + "<PARAM NAME='AnimationAtStart' VALUE=0>"
	moviestr = moviestr + "<PARAM NAME='TransparentAtStart' VALUE='1'>"
	moviestr = moviestr + "<EMBED WIDTH='"+w+"' HEIGHT=45 TYPE='application/x-mplayer2' PLUGINSPAGE='http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/' FILENAME='"+url+"' SHOWDISPLAY=0 SHOWCONTROLS=1 SHOWTRACKER=1 AUTOSTART=1></EMBED>"
	moviestr = moviestr + "</OBJECT>"

	doc = mm('',winw,winh).document;

	doc.open("text/html");

	if(document.all)
		doc.charset=document.charset;
	else
		doc.characterset=document.characterset;

	doc.write("<HTML><HEAD><TITLE>Neura.net</TITLE></HEAD><BODY marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 bgcolor='#ffffff'><TABLE border=0 cellpadding=0 cellspacing=0 align=center width='100%' height='100%'><TR><TD align=center valign=middle>");

	doc.write("<TABLE border=0 cellpadding=0 cellspacing=0 width='"+w+"'>");
	if(title!="")
		doc.write("<TR><TD align=center><FONT face='Georgia, Verdana, Tahoma, Arial, Helvetica' color='#f21513' size='2'><B>"+title+"</B></FONT><BR><IMG src='"+ll+"/images/spacer.gif' width=1 height=1></TD></TR>");
	doc.write("<TR><TD>"+moviestr+"</TD></TR>");
	doc.write("</TABLE>");

	doc.write("</TD></TR></TABLE></BODY></HTML>");

	doc.close();
}
