function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
   { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}

function validateEmail(Email)
{	
	if (Email == "")
		return false;
	var supported = 0;
	if (window.RegExp)
	{
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) 				
		return (Email.indexOf(".") > 2) && (Email.indexOf("@") > 0);				
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	if(!r1.test(Email) == false || r2.test(Email) == false)
	{
		errorMessage = " * Pleast enter a valid e-mail address";
	}
	return (!r1.test(Email) && r2.test(Email));
}
function moveToUrl(newURL)
{
	//top.document.getElementById('MainFrame').src=newURL;
	window.document.location.href = newURL;
}

function OpenID(theID)
{
	document.getElementById(theID).style.visibility = "visible";
	document.getElementById(theID).style.display = "block";
}

function CloseID(theID)
{
	document.getElementById(theID).style.visibility = "hidden";
	document.getElementById(theID).style.display = "none";
}

function OpenOrClose(theID)
{
	if (document.getElementById(theID).style.visibility == "hidden")
		document.getElementById(theID).style.visibility = "visible";
	else
		document.getElementById(theID).style.visibility = "hidden";
		
	if (document.getElementById(theID).style.display == "none")
		document.getElementById(theID).style.display = "block";
	else
		document.getElementById(theID).style.display = "none";
}

	var SoundUniqueID = 314 // Make each link open in a new window 
	var newSoundWinOffset = 0 // Position of first pop-up

	function PlayerOpen(soundfiledesc,soundfilepath) 
	{ 
		PlayWin = window.open(soundfiledesc,SoundUniqueID,'width=320,height=40,top=' + newSoundWinOffset +',left=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
		PlayWin.focus(); 
		var winContent = "<HTML><HEAD><LINK href=\"../css/styles.css\" type=\"text/css\" rel=\"stylesheet\"><TITLE>" + soundfiledesc + "</TITLE></HEAD><BODY class=FrameMainDocument1>"; 
		winContent += "<B style='font-size:18px;font-family:Verdana,sans-serif;line-height:1.5'>" + soundfiledesc + "</B>";
		winContent += "<OBJECT width='300' height='42'>"; 
		winContent += "<param name='SRC' value='" + soundfilepath + "'>";
		winContent += "<param name='AUTOPLAY' VALUE='true'>"; 
		winContent += "<param name='CONTROLLER' VALUE='true'>";
		winContent += "<param name='BGCOLOR' VALUE='#FF9900'>"; 
		winContent += "<EMBED SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='FALSE' WIDTH='300' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='#FF9900'></EMBED>";
		winContent += "</OBJECT>"; 
		//winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'></p>";
		winContent += "</BODY></HTML>"; 
		PlayWin.document.write(winContent); 
		PlayWin.document.close(); // "Finalizes" new window 
		SoundUniqueID = SoundUniqueID + 1 // newSoundWinOffset = newSoundWinOffset + 20 // subsequent pop-ups will be this many pixels lower 
	} 
	
function preloadImg(src) 
{
	var dummy = new Image(); dummy.src=src;
}
	
function OpenNewWindow(win_url,win_width,win_height,top_loc,left_loc)
{
	options="width="+win_width+",innerwidth="+win_width+",height="+win_height+",innerheight="+win_height+",top="+top_loc+",left="+left_loc+",toolbar=no,menubar=no,location=no,scrollbars=yes,resize=no,copyhistory=no'";
	var win=window.open(win_url,"product_details",options);
}
	
function photomax(photo,titre)
{
	image=new Image()
	image.src=photo
	var largeur=image.width+20;
	var hauteur=image.height+67;

	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;

	options="width="+largeur+",innerwidth="+largeur+",height="+hauteur+",innerheight="+hauteur+",top="+top+",left="+left+",toolbar=no,menubar=no,location=no,scrollbars=no,resize=no,copyhistory=no"

	var win=window.open("","Zoom",options);
	if (win.opener==null) 
		win.opener=window;

	win.document.write("<html><head><title>"+titre+"</title></head><body background=\"images/bg_top.gif\><p align=\"center\"><img align=\"center\" src=\""+photo+"\"><br></P></body></html>")

	win.document.close()
}

function Sleep(timeToSleep)
{
	setTimeout("return;", timeToSleep); 
}

function photomaxindiv(photo,divid,sName)
{
	image=new Image();
	image.src=photo;
	
	var largeur=image.width;
	var hauteur=image.height;
	var theDiv = document.getElementById(divid);
	Drag.init(theDiv);
	theDiv.innerHTML = "<table style='cursor: pointer;' bgcolor=darkblue width=" + largeur + " ><tr><td nowrap height=15 align=left class=header_text style='cursor: pointer;' onclick='CloseID(\"" + divid + "\");'>X</td><td width=100% nowrap></td><td class=header_text nowrap>MTS - " + sName + "</td></tr>";
	theDiv.innerHTML += "<tr><td nowrap width=100% height=100%><img src='" + photo + "'></td></tr></table>"
	
}

