/*************
* scripts.js *
**************/


//---------------------------------------------
// PREVENT RIGHT CLICK
/*
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
*/

//---------------------------------------------
// DISABLE SELECT TEXT
/*
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
*/


//---------------------------------------------
// STATUS BAR SCROLL TEXT

message     = "Welcome to MILLERMIXTURE.com                                                                                          ^" +
                "Michael Miller - Web / Multimedia Developer - Graphic Artist                                                            ^" +
                "Skilled with 3D Studio Max, Adobe Software, Macromedia Software, ASP, HTML, Javascript, PHP, and XML.             ^" +
				"In MICHAEL'S PORTFOLIO you can view the applications and scripting langauges I used for any of the given projects.^" +
                "I am available for freelance.                                                                                     ^" +
				"See MICHAEL'S RESUME for contact information.                                                                     ^" +
				"                                                                                                                  ^"

scrollSpeed = 50
lineDelay   = 1000

// Do not change the text below //
txt         = ""

function scrollText(pos) {
    if (message.charAt(pos) != '^') {
      txt    = txt + message.charAt(pos)
      status = txt
      pauze  = scrollSpeed
    }
    else {
      pauze = lineDelay
      txt   = ""
      if (pos == message.length-1) pos = -1
    }
    pos++
    setTimeout("scrollText('"+pos+"')",pauze)
  }

//scrollText(0)


// Global variables defined outside of the functions.
var newWin = null
var winname = null

function NEW_winopen(jmppage, wname, w, h)
// Opens a new window.  
//   jmppage = href, wname = window name, h = window height, w = window width
// The window name is used as a local reference to change its properties.
// It is also used to see if the content is changing, so each URL should
//   have its own window name.
// The global variable newWin is the object reference to the new window and
// is used to control the window (such as closing it).
{
	// See if window reference is already set.  It will still be set
	// even if the user closes the window manually.
	if (newWin != null)
	{
		// See if we are trying to open the same window or a new one or 
		// if window has been closed.
		if ((winname != wname) || (newWin.closed))
		{
			alert("check1");
			// New window or old window has been closed.  Close the old one first.
			closeNewWin();
			openNewWin(jmppage, wname, w, h)
		}
		else
		{
			// Trying to open the same window.  Bring it to the front.
			newWin.focus()
		}
	}
	else
	{
		// Brand new window.
		openNewWin(jmppage, wname, w, h)
	}
}

function openNewWin(jumpref, wname, wsize, hsize)
{
	xpos = (screen.width - wsize) / 2;
	ypos = (screen.height - hsize) / 2;

	winString = "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=" + wsize + ",height=" + hsize
	if (navigator.appName.indexOf("Microsoft")>=0) 
	{
		winString += ',left=' + xpos + ',top=' + ypos + ''
	}
	else
	{
		winString += ',screenX=' + xpos + ',screenY=' + ypos + ''
	}
   
	newWin = window.open(jumpref, wname, winString);

	// Special code to check for PDF file in IE (still thinks its IE3).
	if ((document.all) && (jumpref.indexOf(".pdf") != -1))
	{
		// Need to open the window a second time with no URL.
		newWin = window.open("", wname, winString);
	}

	// Hold onto the current window name.
	winname = wname
}

function closeNewWin()
{
	// See if window reference is already set.  Only close an open window.
	
	if (newWin != null)
	{
		// See if window is closed.  Only close an open window.
		if (newWin.closed == false)
		{
			// Close the window.
			newWin.close();
		}
		// Clear the current window name.
		winname = null
	}
}

//---------------------------------------------

function winopen2(theURL,theName,wsize,hsize) {
var winl = (screen.width - wsize) / 2;
var wint = (screen.height - hsize) / 2;
var winString = "toolbar=no,top=" + wint + ",left=" + winl + ",location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + wsize + ",height=" + hsize;
window.open(theURL, theName, winString);
//window.focus(theName);
}

function winopen(theURL,theName,wsize,hsize) {
var winl = (screen.width - wsize) / 2;
var wint = (screen.height - hsize) / 2;
var winString = "toolbar=no,top=" + wint + ",left=" + winl + ",location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=" + wsize + ",height=" + hsize;
window.open(theURL, theName, winString);
//window.focus(theName);
}

function video_high(h_url) {
winopen(h_url, 'video_High',350,400);
}
function video_low(l_url) {
winopen(l_url, 'video_Low',200,240);
}

function goto_link(theURL) {
window.location.href=theURL;
}

/*
<!-- ================================================= -->
<!-- JAVASCRIPT emailprotect - start -->
<!-- ================================================= -->
*/
function emailprotect(username, displayName){

var domain = "eurosportdaytona.com";
var mail = username + "&#64;" + domain;

//document.write("<a href=\"mailto:"+mail+"\">"+displayName+"</a>");
document.write("<a href=\"redirect_mailto.php?username=" + username + "\"><B>"+displayName+"</B></a>");

}
/*
<!-- ================================================= -->
<!-- JAVASCRIPT emailprotect - end -->
<!-- ================================================= -->
*/

function safemail(name, domain, display) {
displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
document.write('<a href=mailto:' + name + '@' + domain + '>' + displayed + '</a>');
}

function display_safemail(name, domain) {
document.write('<a CLASS="maillink" href=mailto:' + name + '@' + domain + '>' + name + '@' + domain + '</a>');
}

function safemail_icon(name, domain, image) {
document.write('<a href=mailto:' + name + '@' + domain + '><img src="' + image + '" border=0></a>');
}

//Highlight Table Cells Script-- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD"&&source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if
(ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR"||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
}


// -----------------------------------------
// text counter
// -----------------------------------------

function msgcount(counter,msg,limit) {
	if (msg.value.length > limit)
		msg.value = msg.value.substring(0,limit);
	else 
		counter.value = limit - msg.value.length;
	}

// -----------------------------------------
// SlideShow - Scripts
// -----------------------------------------

if(!window.JSFX)
	JSFX = new Object();

document.write('<STYLE TYPE="text/css">.slideTrans{ filter:revealTrans(duration=1,transition=0) }</STYLE>');
document.write('<STYLE TYPE="text/css">.slideBlend{ filter:blendTrans(duration=1) }</STYLE>');

JSFX.ClickableSlide = function(theImg, theUrl, theTarget)
{
	this.theImg  = theImg;
	 this.theUrl    = theUrl    == null ? "#" : theUrl;
	 this.theTarget = theTarget == null ? "_self" : theTarget;
	this.loadImg = new Image();
}
JSFX.ClickableSlideShow = function(transtype,slidedelay,transduration)
{
	this.id		= JSFX.ClickableSlideShow.getId();
	this.timeId		= null;
	this.imgName	= this.id + "_I";
	this.urlId		= this.id + "_U";
	this.currSlide	= 0;
	this.slides		= new Array();
	this.startDelay   = 1;
	this.slideDelay	= slidedelay*1000;
	this.transType	= transtype;
	this.transDuration= transduration;

	window[this.id] = this;
}
JSFX.ClickableSlideShow.slideNo = 0;
JSFX.ClickableSlideShow.getId                      = function()              {return "JSFX_cs_" + JSFX.ClickableSlideShow.slideNo++;}
JSFX.ClickableSlideShow.prototype.addSlide         = function(theImg, theUrl, theTarget)
{
	this.slides[this.slides.length]=new JSFX.ClickableSlide(theImg, theUrl, theTarget);
}
JSFX.ClickableSlideShow.prototype.setStartDelay    = function(startDelay)    {this.startDelay    = startDelay*1000;}
JSFX.ClickableSlideShow.prototype.setSlideDelay    = function(slideDelay)    {this.slideDelay    = slideDelay*1000;}
JSFX.ClickableSlideShow.prototype.setTransType     = function(transType)     {this.transType     = transType;}
JSFX.ClickableSlideShow.prototype.setTransDuration = function(transDuration) {this.transDuration = transDuration;}
JSFX.ClickableSlideShow.prototype.setTimeout       = function(f, t)          {return setTimeout("window."+this.id+"."+f, t);}

JSFX.ClickableSlideShow.prototype.toHtml           = function()
{
   return('\
<IMG SRC="'+this.slides[0].theImg+'" \
NAME="'+this.imgName+'" \
class="slide'+(this.transType==24?"Blend":"Trans")+'" \
alt="">');
}
JSFX.ClickableSlideShow.prototype.setSlide = function()
{
	var img = document.images[this.imgName];
	if(img.filters != null)
	{
		if(this.transType < 24)	img.filters[0].Transition=this.transType;
		img.filters[0].Duration = this.transDuration;
		img.filters[0].apply();
	}
	img.src    = this.slides[ this.currSlide ].theImg;
	if(img.filters != null)
		img.filters[0].play();
}

JSFX.ClickableSlideShow.prototype.animate = function()
{
	this.currSlide = (this.currSlide + 1) % this.slides.length;
	this.setSlide();
	this.timeId = this.setTimeout("animate()", this.slideDelay);
}
JSFX.ClickableSlideShow.prototype.start = function(a,b,c,d)
{
	for(var i=0 ; i<this.slides.length ; i++)
		this.slides[i].loadImg.src = this.slides[i].theImg;
	var theImg         = document.images[this.imgName];
	theImg.onmouseup = this.clickFn;
	theImg.ss          = this;
	this.timeId = this.setTimeout("animate()", this.startDelay + this.slideDelay);
}
JSFX.ClickableSlideShow.prototype.clickFn = function()
{
	return;
	var ss = this.ss;
	var slide = ss.slides[ss.currSlide];
	if( slide.theTarget.charAt(0) =="_")
	{
		if(slide.theTarget == "_blank")
			window.open(slide.theUrl, ss.id);
		else
			document.location = slide.theUrl;
	}
	else
	{
		if(this.nw && !this.nw.closed) this.nw.close();
		this.nw=window.open(slide.theUrl, ss.id, slide.theTarget);
		this.nw.focus();
	}
}

//---------------------------------------------
//Image Swap & Image Restore for button rollovers

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_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_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_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];}
}





//==============================================
//==============================================
// NOT IN USE YET - start
//==============================================
//==============================================

//Open different window
var newSearchWin = null
var winSearchname = null
var winHsize = 600
var winWsize = 800

function newSearchWindow()
{
if (newSearchWin != null)
{
if (newSearchWin.closed)
{
closeNewSearchWin();
openNewSearchWin("theSearchWin", winHsize, winWsize);
}
else
{
newSearchWin.focus();
}
}
else
{
openNewSearchWin("theSearchWin", winHsize, winWsize);
}
}

function openNewSearchWin(wSearchname, hsize, wsize)
{
var winl = (screen.width - wsize) / 2;
var wint = (screen.height - hsize) / 2;
winSearchString = "toolbar=no,top=" + wint + ",left=" + winl + ", location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + wsize + ",height=" + hsize;
urlSearchString = finalSearchString;
newSearchWin = window.open(urlSearchString, wSearchname, winSearchString);
winSearchname = wSearchname;
}

function closeNewSearchWin()
{
if (newSearchWin != null)
{
if (newSearchWin.closed == false)
{
newSearchWin.close();
}
winSearchname = null;
}
}

//==============================================
//==============================================
// NOT IN USE YET - end
//==============================================
//==============================================