function fireEmbeddedPlayer(href,name)
{
var myWindow = window.open("", "tinyWindow", 'width=300,height=250');
myWindow.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
myWindow.document.write("<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>University of Georgia - Small Business Development Center Embedded Media Player</title></head>");
myWindow.document.write("<link href=\"css/sbdc.css\" type=\"text/css\" rel=\"stylesheet\" />");
myWindow.document.write("<body>");
myWindow.document.write("<h2>"+name+"</h2>");
myWindow.document.write("<a href=\"http://www.georgiasbdc.org\"><img src=\"http://www.sbdc.uga.edu/images/sbdclogo.gif\" /></a>");
myWindow.document.write("<object id=\"mediaPlayer\" CLASSID=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\"");
myWindow.document.write("codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\"");
myWindow.document.write("standby=\"Loading Microsoft Windows Media Player components...\"");
myWindow.document.write("type=\"application/x-oleobject\">");
myWindow.document.write("<param name=\"fileName\" value=\"" + href + "\" />");
myWindow.document.write("<param name=\"animationatStart\" value=\"true\" />");
myWindow.document.write("<param name=\"transparentatStart\" value=\"true\" />");
myWindow.document.write("<param name=\"autoStart\" value=\"true\" />");
myWindow.document.write("<param name=\"showControls\" value=\"true\" />");
myWindow.document.write("</object></body></html>");
myWindow.document.close();

}


function getParameter ( queryString, parameterName )
{
    parameterName = parameterName + "=";                            // Add "=" to the parameter name (i.e. parameterName=value)
    if ( queryString.length > 0 ) {
        
        var begin = queryString.indexOf ( parameterName );                  // Find the beginning of the string
        if ( begin != -1 ) {                                            // If the parameter name is not found, skip it, otherwise return the value
            begin += parameterName.length;                              // Add the length (integer) to the beginning
            var end = queryString.indexOf ( "&" , begin );                  // Multiple parameters are separated by the "&" sign
            if ( end == -1 ) {                              
                end = queryString.length
            } //end of if
            return unescape ( queryString.substring ( begin, end ) );    // Return the string
        } //end of if
        return "null";  // Return "null" if no parameter has been found
    } //end of if 
 } //end of function getParameter
function sortNumber(a, b)
{
    if (a == "($1.00)") {
        return -1 }
    else if (b == "($1.00)") {
        return 1 }
    else {
        return a.substring(1,a.length) - b.substring(1,b.length)
    }
}
function KeepCount(seriesKey) {
    var newCount = 0;
    var arrChkbxs = document.getElementsByName("cb"+seriesKey);
    for (var i=0; i < arrChkbxs.length; i++) {
       if (arrChkbxs[i].checked == true) {
            newCount ++;
        } //end of if 
    } //end of for loop
    if (newCount == 1) {
       alert('You must choose two or more programs for a Series discount. \n Single programs are listed below the Series listings by category.');
       return false;
    } //end of if
    else {
        recalculate(seriesKey,newCount);
        return true;
    }
} //end of function keepCount 

function recalculate(seriesKey, newCount)
{   
    var array = eval('seriesarray' + seriesKey).sort(sortNumber);
   
    if (array[newCount-1] != "($1.00)") {
        document.getElementById(seriesKey).innerHTML = array[newCount-1];
    } else {
        document.getElementById(seriesKey).innerHTML = array[newCount];
    }
    var arrChkbxs = document.getElementsByName("cb"+seriesKey);
    var hrefAddition = "&special=";
    for (var i=0; i < arrChkbxs.length; i++) {
       if (arrChkbxs[i].checked == true) {
              hrefAddition += "1,"
        } else {
              hrefAddition += "0,"
        }
    } //end of for loop
    if (document.getElementById('buyLink'+seriesKey).href.lastIndexOf('&special=') > 0) {
           document.getElementById('buyLink'+seriesKey).href = document.getElementById('buyLink'+seriesKey).href.substring(0,document.getElementById('buyLink'+seriesKey).href.lastIndexOf('&special=')) + hrefAddition;
        } else {
           document.getElementById('buyLink'+seriesKey).href = document.getElementById('buyLink'+seriesKey).href + hrefAddition;
        }
} //end of function fire window  


function firewindow(productid, noBuy)
{   
    if (typeof noBuy == "undefined") {
        noBuy = "false";
    }    
    if (noBuy == "true") {  
        var msgWindow = window.open("?page_name=description&product="+productid+"&referrer="+getParameter(window.location.href, 'page_name')+"&city="+getParameter(window.location.href, 'city')+"&nobuy=true","msgWindow","scrollbars=yes,width=500,height=400");
    } else {
        var msgWindow = window.open("?page_name=description&product="+productid+"&referrer="+getParameter(window.location.href, 'page_name')+"&city="+getParameter(window.location.href, 'city'),"msgWindow","scrollbars=yes,width=500,height=400");
    }
    
	msgWindow.focus();
} //end of function fire window  

function fireURLwindow(URL)
{
	var msgWindow = window.open(URL,"msgWindow","scrollbars=yes,width=800,height=600"); 
	msgWindow.focus();
} //end of function fireURLwindow  

// generic macromedia functions for image rollovers
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.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];}
}



sfHover = function() {
	if(document.getElementById("nav")) {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" over";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" over\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
