function formFocus()
{
	if(document.forms[0].elements[0])
	{
		if (document.forms[0].length > 0 && (document.forms[0].name == 'Login' || document.forms[0].name == 'Register'))
		{
			document.forms[0].elements[0].focus();
		}
	}
}

function loginCheck()
{
uidlen  = document.Login.uidform.value;
passlen = document.Login.password.value;

		if (document.Login.uidform.value == "")
		{
			alert('Please enter a username');
			document.Login.uidform.focus();
			return false;
		}
		if (uidlen.length < 3)
		{
			alert('username must be atleast 4 char long')
			document.Login.uidform.focus()
			return false
		}
		if (document.Login.password.value == "")
		{
			alert('Please enter a password')
			document.Login.password.focus()
			return false
		}	
		if (passlen.length < 6)
		{
			alert('password must be atleast 6 char long')
			document.Login.password.focus()
			return false
		}
}

function Popup(url, window_name, window_width, window_height) 
{ 
	var WinWd, WinHt;

	showindow = "toolbar=no,location=no,directories=no,"+ "status=no,menubar=no,scrollbars=yes,"+ "resizable=yes,width="+window_width+",height="+window_height; 

	WinWd = screen.width/2 - window_width/2;
	WinHt = screen.height/2 - window_height/2;

	NewWindow=window.open(url,window_name,showindow);
	NewWindow.moveTo(WinWd,WinHt);
}

function PopupForm(window_name, window_width, window_height, maximise)
{ 
	var WinWd, WinHt;

	showindow = "toolbar=no,location=no,directories=no,"+ "status=no,menubar=no,scrollbars=yes,maximise="+maximise+",resizable="+maximise+","+"width="+window_width+",height="+window_height; 

	WinWd = screen.width/2 - window_width/2;
	WinHt = screen.height/2 - window_height/2;

	NewWindow=window.open('',window_name,showindow);
	NewWindow.moveTo(WinWd,WinHt);
}

function smilie(thesmilie, fieldname)
{
	fieldname.value += thesmilie+" ";
	fieldname.focus();
}

function fieldHighlight( fieldname, depth )
{
	if(fieldname.checked)
	{
		val = 1;
	}
	else
	{
		val = 0;
	}

	E = fieldname;
	var j = 0;

	while (E.tagName!="TR" && j < depth)
	{
		if(document.all)
		E=E.parentElement
		else
		E=E.parentNode

		j++;
	}

	if(E.tagName=="TR")
	{
		if(val == "1")
		E.className = 'alterRowHighlight';
		else
		E.className = 'alterRowDeHighlight';
	}

	return( true );
}

function SetChecked(dml, depth)
{
	len = dml.elements.length;
	var i = 0;

	if(depth < 0)
	{
		depth = 3;
	}

	if(dml.allbox.checked)
	{
		val = 1;
	}
	else
	{
		val = 0;
	}

	for( i=0 ; i<len ; i++) 
	{
		dml.elements[i].checked=val

		E = dml.elements[i];
		var j = 0;

		while (E.tagName!="TR" && j < depth)
		{
			if(document.all)
			E=E.parentElement
			else
			E=E.parentNode

			j++;
		}

		if(E.tagName=="TR")
		{
			if(val == "1")
			E.className = 'alterRowHighlight';
			else
			E.className = 'alterRowDeHighlight';
		}
	}
}

function RotateCheck()
{
var angle;
angle = eval(document.rotate.param_a.value);

if(!angle)
{ alert('You must specify an angle value'); 
  document.rotate.param_a.focus();
  return false; }
}

function GammaCheck()
{
var red, green, blue;

red = eval(document.gamma.param_a.value);
green = eval(document.gamma.param_b.value);
blue = eval(document.gamma.param_c.value);

if(red > 5)
{ alert('Red color must be < 5'); 
  document.gamma.param_a.focus()
  return false }

if(red < 0)
{ alert('Red color must be > 0'); 
  document.gamma.param_a.focus()
  return false }

if(green > 5)
{ alert('Green color must < 5'); 
  document.gamma.param_b.focus()
  return false }

if(green < 0)
{ alert('Green color must be > 0'); 
  document.gamma.param_b.focus()
  return false }

if(blue > 5)
{ alert('Blue color must < 5'); 
  document.gamma.param_c.focus()
  return false }

if(blue < 0)
{ alert('Blue color must be > 0'); 
  document.gamma.param_c.focus()
  return false }
}

function BrightCheck()
{
var brt, sat, hue;

brt = eval(document.bright.param_a.value);
sat = eval(document.bright.param_b.value);
hue = eval(document.bright.param_c.value);

if(brt < -100 || brt > 100)
{ alert('<?php echo($_Lang_Errors[81]); ?>'); 
  document.bright.param_a.focus()
  return false }

if(sat < -100 || sat > 100)
{ alert('<?php echo($_Lang_Errors[82]); ?>'); 
  document.bright.param_b.focus()
  return false }

if(hue < -100 || hue > 100)
{ alert('<?php echo($_Lang_Errors[83]); ?>'); 
  document.bright.param_c.focus()
  return false }
}

function ListenWindow()
{
	ListenMusic=window.open( document.ecard.music.value ,"ListenMusic","status=no,resize=no,toolbar=no,scrollbars=no,width=200,height=100,maximize=no");

	var WinWd, WinHt;
	WinWd = screen.width/2 - 100;
	WinHt = screen.height/2 - 50;
	ListenMusic.moveTo(WinWd,WinHt);

	return false;
}

function AlbumThemeWindow( url, closewin, athemeid )
{
	if(closewin == 1)
	{
		if(GetCookie('albinatoratheme'))
		{
			DeleteCookie ("albinatoratheme")
			AlbumTheme=window.open("","AlbumTheme","status=no,resize=no,toolbar=no,scrollbars=no,width=200,height=100,maximize=no");
			AlbumTheme.close();
		}
	}
	else
	{
		if(!GetCookie('albinatoratheme') || GetCookie('albinatoratheme') != athemeid )
		{
			SetCookie("albinatoratheme", athemeid);
			AlbumTheme=window.open(url,"AlbumTheme","status=no,resize=no,toolbar=no,scrollbars=no,width=200,height=100,maximize=no");

			var WinWd, WinHt;
			WinWd = screen.width/2 - 100;
			WinHt = screen.height/2 - 50;
			AlbumTheme.moveTo(WinWd,WinHt);
		}
	}
	self.focus();
}

function relaxUpload() 
{
	relaxUpload=window.open("relax.php","relaxUpload","status=no,resize=no,toolbar=no,scrollbars=no,width=350,height=200,maximize=no");

	var WinWd, WinHt;
	WinWd = screen.width/2 - 175;
	WinHt = screen.height/2 - 100;
	relaxUpload.moveTo(WinWd,WinHt);
}

//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var checkobj

function agreesubmit(el)
{
	checkobj=el
	if (document.all||document.getElementById)
	{
		for (i=0;i<checkobj.form.length;i++)
		{
			var tempobj=checkobj.form.elements[i]

			if(tempobj.type.toLowerCase()=="submit")
			tempobj.disabled=!checkobj.checked
		}
	}
}


<!--- Cookie JavaScript (c) Amit Arora <amit.arora@bigfoot.com> --->

    function SetCookie (name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = new Date();
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
	  expires.setYear(expires.getYear()+1);
        document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString()+1800)) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }

    function getCookieVal (offset) {
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
        endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
    }

    function GetCookie (name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen)
        	{
        	var j = i + alen;
        	if (document.cookie.substring(i, j) == arg)
        	return getCookieVal (j);
        	i = document.cookie.indexOf(" ", i) + 1;
        	if (i == 0) break;
        	}
        return null;
    }

    function DeleteCookie (name) {
        var exp = new Date();
        exp.setTime (exp.getTime() - 1);
        var cval = GetCookie (name);
        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    }

var imagecounter = 1
var imagemsgcounter = 0

function slideWork()
{
	if (curpos<100)
	{
		curpos+=10
		if (tempobj.filters)
		tempobj.filters.alpha.opacity=curpos
		else if (tempobj.style.MozOpacity)
		tempobj.style.MozOpacity=curpos/100
	}
	else
	{
		clearInterval(dropslide)
		nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
		tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
		tempobj.innerHTML='<img src="'+slideshowimg[nextimageindex]+'" width="'+slideshow_maxwt+'" height="'+slideshow_maxht+'" />'
		currentMessage.innerHTML=slideshowpmsg[imagemsgcounter]
		currentPosition.innerHTML=imagecounter

		nextimageindex=(nextimageindex<slideshowimg.length-1)? nextimageindex+1 : 0
		imagecounter++
		imagemsgcounter++

		if(imagecounter <= slideshowimg.length)
		{
			setTimeout("moveNext()",interval)
		}
	}
}

function moveNext()
{
	if (ie4||dom)
	{
		restartShow(curcanvas)
		var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
		crossobj.style.zIndex++
		var temp='setInterval("slideWork()",50)'
		dropslide=eval(temp)
		curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
	}
	else
	{
		document.images.defaultslide.src=slideshowimg[curimageindex]
		curimageindex=(curimageindex<slideshowimg.length-1)? curimageindex+1 : 0
	}
}

function restartShow(what)
{
	curpos=10
	var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
	if (crossobj.filters)
	crossobj.filters.alpha.opacity=curpos
	else if (crossobj.style.MozOpacity)
	crossobj.style.MozOpacity=curpos/100
}

function startSlide()
{
	var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
	crossobj.innerHTML='<img src="'+slideshowimg[curimageindex]+'" width="'+slideshow_maxwt+'" height="'+slideshow_maxht+'" />'
	moveNext()
}

function makeSlideShow()
{
	if (ie4||dom)
	window.onload=startSlide
	else
	setInterval("moveNext()",interval)
}

function reMakeSlideShow()
{
	var curpos=10
	var degree=10
	var curcanvas="canvas0"
	var curimageindex=0
	var nextimageindex=1

	if (ie4||dom)
	window.onload=startSlide
	else
	setInterval("moveNext()",interval)
}