
function round(number,X) 

	{
		return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
	}
	
	function rates (getit) 
		{
			var a= getit.split("#");
			var arate = a[1];
			var aaccess = a[3];
	
			if (arate!='')
				{
					document.formrate.access.value=aaccess;
					document.formrate.rate.value=arate;
				} 
			else 
				{
					document.formrate.access.value='';
					document.formrate.rate.value='';
				}
		}

/*
Alternating row color script by Joost de Valk ( http://www.joostdevalk.nl/ ) to add alternating row classes to a table.
Copyright (c) 2006 Joost de Valk.
*/

/* Don't change anything below this unless you know what you're doing */
addEvent(window, "load", alternate_init);

function alternate_init() {
	// Find all tables with class sortable and make them sortable
	if (!document.getElementsByTagName) return;
	tbls = document.getElementsByTagName("table");
	for (ti=0;ti<tbls.length;ti++) {
		thisTbl = tbls[ti];
		if (((' '+thisTbl.className+' ').indexOf("alternate_rows") != -1) && (thisTbl.id)) {
			alternate(thisTbl);
		}
	}
}

function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+,	NS6 and Mozilla
// By Scott Andrew
{
	if (elm.addEventListener){
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent){
		var r = elm.attachEvent("on"+evType, fn);
		return r;
	} else {
		alert("Handler could not be removed");
	}
} 

function replace(s, t, u) {
  /*
  **  Replace a token in a string
  **    s  string to be processed
  **    t  token to be found and removed
  **    u  token to be inserted
  **  returns new String
  */
  i = s.indexOf(t);
  r = "";
  if (i == -1) return s;
  r += s.substring(0,i) + u;
  if ( i + t.length < s.length)
    r += replace(s.substring(i + t.length, s.length), t, u);
  return r;
}

function sendMail(myform)
{
	myform.action="http://www.cheerssecure.co.uk/greentele/formmail.asp"
}

function checkForm(myform)
{
  // see http://www.thesitewizard.com/archive/validation.shtml
  // for an explanation of this script and how to use it on your
  // own website

  // ** START **
  if (myform.email.value == "") {
    alert( "Please fill up your form and then submit" );
    //form.email.focus();
    return false ;
  }
  // ** END **
  return true ;
}

function alternate(table) {
	// Take object table and get all it's tbodies.
	var tableBodies = table.getElementsByTagName("tbody");
	// Loop through these tbodies
	for (var i = 0; i < tableBodies.length; i++) {
		// Take the tbody, and get all it's rows
		var tableRows = tableBodies[i].getElementsByTagName("tr");
		// Loop through these rows
		for (var j = 0; j < tableRows.length; j++) {
			// Check if j is even, and apply classes for both possible results
			if ( (j % 2) == 0  ) {
				if (tableRows[j].className == 'odd' || !(tableRows[j].className.indexOf('odd') == -1) ) {
					tableRows[j].className = replace(tableRows[j].className, 'odd', 'even');
				} else {
					tableRows[j].className += " even";
				}
			} else {
				if (tableRows[j].className == 'even' || !(tableRows[j].className.indexOf('even') == -1) ) {
					tableRows[j].className = replace(tableRows[j].className, 'even', 'odd');
				}
				tableRows[j].className += " odd";
			} 
		}
	}
}

function HidePlayer()
	{
	document.getElementById('player3').style.display= 'none';
	}

//function loadvideos(videoname)

//{
	//document.getElementById('player3').style.display= 'inline';
//	var so = new SWFObject('__videos/flvplayer.swf','mpl','377','230','7');
//	so.addVariable('file','__videos/playlist.asp?videoname='+videoname);
//	so.addParam('allowfullscreen','true');
//	so.addParam('allowscriptaccess','always');
//	so.addVariable('displayheight','230');	
//	so.addVariable('thumbsinplaylist','false');
//	so.addVariable('showdigits','true');
//	so.addVariable('showdownload','false');
//	so.addVariable('overstretch','true');
//	so.addVariable('height','230');
//	so.addVariable('width','377');
//	so.addVariable('backcolor','0x00000');
//	so.addVariable('frontcolor','0x999999');
//	so.addVariable('lightcolor','0x6aa757');
//	so.addVariable('kenburns','true');
	
	//var so = new SWFObject('__videos/flvplayer.swf','jstest','377','230','8');
//	so.addParam('allowscriptaccess','always');
//	so.addParam('allowfullscreen','true');
//	so.addVariable('width','377');
//	so.addVariable('height','230');
//	so.addVariable('file','__videos/files/Azan-mekka.flv');
//	so.addVariable('javascriptid','jstest');
//	so.addVariable('enablejs','true');
//	so.write('player3');
//}

var thePlayer;
var thePlayerRoot;
var theList;
var theListRoot;

function initialize() {

	createPlayer("../__videos/files/Azan-mekka.flv", "__videos/files/Azan-mekka.jpg", false, false);
}


function createPlayer(theFile, theImg, start, icons) {
	var so = new SWFObject("__videos/flvplayer.swf","mpl","377","230","7");
	so.addParam('allowfullscreen','true');
	so.addParam('wmode', 'transparent');
	so.addParam('allowscriptaccess','always');
	so.addVariable('displayheight','230');	
	so.addVariable('thumbsinplaylist','false');
	so.addVariable('showdigits','true');
	so.addVariable('showdownload','false');
	so.addVariable('overstretch','true');
	so.addVariable('height','230');
	so.addVariable('width','377');
	so.addVariable('backcolor','0x00000');
	so.addVariable('frontcolor','0x999999');
	so.addVariable('lightcolor','0x6aa757');
	so.addVariable('kenburns','true');
	so.addVariable("file", theFile);
	if (start) so.addVariable("autostart", "true");
	if (! icons) so.addVariable("showicons", "true");
	if (theImg != "") so.addVariable("image", theImg);

	so.write("player3");
}


function play(number, videoname, imgname) {
	switch(number) {
		case 2: createPlayer('../__videos/files/'+videoname, '../__videos/files/'+imgname, true, true);
  		break    
		default: createPlayer("../__videos/files/Azan-mekka.flv", "__videos/files/Azan-mekka.jpg", true, true);
	}
}
