
window.onload = function() { 
	if (document.getElementById('main-video')) { 
		var gv_video = new SWFObject('\/images\/gv-player-list.swf', 'main-video-embed', '327', '280', '6', '#ffffff'); 
		gv_video.addParam("wmode", "transparent");
		gv_video.addParam("allowFullscreen", "true");
		gv_video.addVariable("xml_source", "/data/playlist.xml");
		gv_video.addVariable("toplist", "nrcha-09-rev.flv");
		gv_video.write('main-video'); 
	}
	if (document.getElementById('stockhorse-video')) { 
		var gv_video = new SWFObject('\/images\/gv-player-list.swf', 'stockhorse-video-embed', '327', '280', '6', '#ffffff'); 
		gv_video.addParam("wmode", "transparent");
		gv_video.addParam("allowFullscreen", "true");
		gv_video.addVariable("xml_source", "/data/stockhorse-playlist.xml");
		gv_video.addVariable("toplist", "de-mystify.flv");
		gv_video.write('stockhorse-video'); 
	}
	if (document.getElementById('contact-form')) {
		document.getElementById('contact-form').onsubmit=function() { return checkContact(); };
	}
}; 

function newWin(url,img,title,w,h) {

	   if (! (url) && ! (img)) { return; }
	   var day= new Date();
	   var id = day.getTime();
	   var ww = w+75;
	   var wh = h+125;
	   if ((screen.height) && (wh > screen.height-100)) { wh = screen.height-100; }
	   var params = 'width='+ww+',height='+wh+',scrollbars,resizable';
	   var t = (title != '')?title:img;
	   if (url=='') {
	      var msg='<!DOCTYPE HTML PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org/TR\/html4\/loose.dtd">\n'+
		          '<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1">\n'+
		          '<html><head><title>'+t+'<\/title><\/head>'+
		          '<style type="text\/css">\n'+
				  'html,body { font-family: Arial,Helvetica,Sans-Serif; }\n'+
				  'h3 { text-align: center; }\n'+
				  'td { text-align: center; }\n'+
				  '<\/style><body>\n'+
				  '<h3>'+t+'<\/h3>\n <table align="center" border="0"><tr><td><img src="\/'+img+'" width="'+w+'" height="'+h+'" border="0" alt="'+title+'"></td></tr>\n'+
				  '<tr><td><hr width="100%" size="1"><form><input type="button" onClick="javascript:window.close();" value="Close Window">\n'+
				  '<hr width="100%" size="1"><\/form><\/td><\/tr><\/table><\/body><\/html>\n';
	      var win = open('',id,params);
		  win.document.write(msg);
		  win.document.close();
	   }
	   else { var win = open(url,id,params); } 
	   return false;
}

function newWindow(img, title, wid, ht) {
        day = new Date();
        id = day.getTime();
        var winWidth = wid + 50;
        var winHeight = ht + 125;
        if ((screen.height) && (winHeight > screen.height)) { winheight=screen.height-60; }
        var params = 'width=' + winWidth + ',height=' + winHeight + ',scrollbars,resizable';
        var newWindow = open ('',id, params);
        newWindow.document.write('<HTML><HEAD><TITLE>' + title + '<\/TITLE><\/HEAD><BODY>\n');
        newWindow.document.write('<FONT FACE="Arial, Helvetica, Sans-Serif" SIZE="-1">\n');
        newWindow.document.write('<H3 ALIGN="center">' + title + '<\/H3>\n');
        newWindow.document.write('<DIV ALIGN="center"><A HREF="javascript:window.close();"><IMG SRC="\/images/' + img + '" width="' + wid + '"height="' + ht + '"BORDER="0"><\/A>\n');
        newWindow.document.write('<FORM><INPUT TYPE="button" onClick="javascript:window.close();" VALUE="Close Window" onBlur="this.focus();">\n');
        newWindow.document.write('<\/FORM><\/DIV><\/FONT><\/BODY><\/HTML>\n\n');
        newWindow.document.close();
		return false;
}
	 
function urlWin(file, wid, ht) {
        day = new Date();
        id = day.getTime();
        var winWidth = wid + 50;
        var winHeight = ht + 125;
        if ((screen.height) && (winHeight > screen.height)) { winheight=screen.height-60; }
        var params = 'width=' + winWidth + ',height=' + winHeight + ',scrollbars,resizable';
        var newWindow = open (file,id, params);
		return false;
}

//Contact page

function checkContact() {

   var requireds = new Array('Name', 'Email', 'Phone1');
   var msg = ''; var obj;
   if (document.getElementById) {
        for (i=0; i<requireds.length; i++) {
            obj = document.getElementById(requireds[i]);

            if (obj.value == '') {
                msg = 'In order for us to answer your inquiry,\n' +
                      'you need to give us your name, at least\n' +
                      'one phone number, and your email address.';
                break;
            }
        }
        if ((msg == '') && (document.getElementById('Email').value != "")) {
            var found = false;
            var emailString = document.getElementById('Email').value;
            for (j=0; j < emailString.length; j++) {
                if (emailString.charAt(j) == "@") { found = true; }
            }
            if (found == false) {
                msg = 'Is that your true email address?\n' +
                      'Please enter your correct email address.\n' +
                      'We will not place you on any mailing lists!\n';
            }
        } 
        if (msg != '') {  alert(msg); return false; }
	}
	return true;
}
