function new_window_1(url) {
	link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=520,height=450,left=1,top=1");
}
function new_window_Player(url) {
	link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=550,height=250,left=200,top=200");
}

// ------- wimpy video player -----------
// Your FLV, SWF and MP3 media files.
//
wimpyFolder = "http://www.sccm.org/scripts/";
// TRAILING SLASH REQUIRED (E.G. "path/")
wimpyFolder = "";
//
// transparentBkgd 
transparentBkgd = "no";
//
// bkgdColor
bkgdColor = "#000000";
//
// startPlayingOnload
startPlayingOnload = "yes";
//
// popUpHelp
popUpHelp = "yes";
//
// loopTrack 
loopTrack = "no";
//
// currentVolume
currentVolume = "100";
//
// controllocation
controllocation = "bottom";
//
// wimpySWFfilename
wimpySWFfilename = "http://www.sccm.org/scripts/wimpyAVsingle.swf";
//
// wimpyHTMLtemplateFilename
wimpyHTMLtemplateFilename = "http://www.sccm.org/scripts/wimpyTemplate.html";

function WimpyAVpopup (filename, width, height){
	rnum = (Math.round((Math.random()*1000000)+1));
	padControls = height+20
	theURL = wimpyFolder+wimpyHTMLtemplateFilename+'?theFile='+filename+'&wW='+width+'&wH='+padControls;
	winName = 'wimpy'+rnum;
	extras = 'width='+width+',height='+padControls
	window.open(theURL,winName,extras);
}

function writeSWFcode(fileSWF, fileIN, theWidth, theHeight){
	rnum = (Math.round((Math.random()*1000000)+1));
	padControls = theHeight+20
	queryString = '';
	queryString += "theFile="+fileIN;
	if(transparentBkgd == "yes"){
		tptBkgd_param = '<param name="wmode" value="transparent" />';
		tptBkgd_embed = 'wmode="transparent" ';
	} else {
		tptBkgd_param = "";
		tptBkgd_embed = "";
	}
	queryString += '&startPlayingOnload='+startPlayingOnload;
	queryString += '&popUpHelp='+popUpHelp;
	queryString += '&loopTrack='+loopTrack;
	queryString += '&controllocation='+controllocation;
	queryString += '&currentVolume='+currentVolume;
	flashCode = '';
	flashCode += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab// - version=7,0,0,0" width="'+theWidth+'" height="'+padControls+' name="wimpy'+rnum+'" id="wimpy'+rnum+'"">';
	flashCode += '<param name="movie" value="'+fileSWF+'?'+queryString+'" />';
	flashCode += '<param name="loop" value="false" />';
	flashCode += '<param name="menu" value="false" />';
	flashCode += '<param name="quality" value="high" />';
	flashCode += '<param name="scale" value="noscale" />';
	flashCode += '<param name="salign" value="lt" />';
	flashCode += '<param name="bgcolor" value="'+bkgdColor+'" />';
	flashCode += tptBkgd_param;
	flashCode += '<embed src="'+fileSWF+'?'+queryString+'" width="'+theWidth+'" height="'+padControls+'" bgcolor="'+bkgdColor+'" loop="false" menu="false" quality="high" scale="noscale" salign="lt" name="wimpy'+rnum+'" id="wimpy'+rnum+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"" '+tptBkgd_embed+'/></object>';
	document.write(flashCode);
}

function WimpyAV(){
	var qsParm = new Array();
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
	fileSWFsend = wimpyFolder+wimpySWFfilename;
	fileINsend = wimpyFolder+qsParm['theFile'];
	writeSWFcode(fileSWFsend, fileINsend, "100%", "100%");
}

function WimpyAVembed(theFileIN, theWidthIN, theHeightIN){
	fileSWFsend = wimpyFolder+wimpySWFfilename;
	fileINsend = wimpyFolder+theFileIN;
	writeSWFcode(fileSWFsend, fileINsend, theWidthIN, theHeightIN);
}
// ------- end wimpy video player ------------


function searchText(e)
{
    var keynum = 0;
    if(window.event) // IE
    {
        keynum = window.event.keyCode
    }
    else if(e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which
    }
    if (keynum == 13)
    {
        doSearch();
        return false;
    }
    return true;
}

function clearSearch(valueToClear)
{
    if (document.getElementById("query").value == valueToClear)
    {
        document.getElementById("query").value = "";
    }
}

function doSearch()
{
    var query = document.getElementById("query").value;
    document.location.href = searchUrl + "?q=" + query + "&client=default_frontend&ud=1&oe=UTF-8&ie=UTF-8&proxystylesheet=default_frontend&site=default_collection&access=p&output=xml_no_dtd";
}
