// Copyright (C) 2003, LinCDs.com
// All the javascript functions for our site LinCDs.com
// are stored in this 'lincds.js' file .
// Amazing, what you can do with a little scripting...
// - g2swaroop@lincds.com

function navmouseover(id)
{
	navlink  = "nava" + id;
	document.getElementById(navlink).style.color = 'blue';
}

function navmouseout(id)
{
	navlink  = "nava" + id;
	document.getElementById(navlink).style.color = 'white';
}

function validate_feedbackform()
{
	// Check name
	{
		var name = document.feedbackform.from_name.value;
		if(name.length < 2)
		{
			alert("Enter your full name");
			return false;
		}
	}

	// Check email
	{
		var email = document.feedbackform.from_email.value;
		if(email.length < 2)
		{
			alert("Enter your email");
			return false;
		}
		var re = /(\w)+[@](\w)+[.](\w){2,}/ig;
		// regular expression test for a@b.cd
		if(! re.test(email) )
		{
			alert("Enter an email in the proper format");
			return false;
		}
	}

	// Check message
	{
		var message = document.feedbackform.message.value;
		if(message.length < 5)
		{
			alert("Enter your message");
			return false;
		}
	}
	return true;
}

function cd_onmouseover(no)
{
	var fgcolor = "black";
	var bgcolor = "orange";
	// see JavaScript documentation for more details
	// Hint :
	// /usr/share/apps/quanta/doc/javascript/index.htm

	document.getElementById( "cdname"  + no ).style.color = fgcolor;
document.getElementById( "cdname"  + no ).style.backgroundColor = bgcolor;
	document.getElementById( "cdno"    + no ).style.color = fgcolor;
document.getElementById( "cdno"    + no ).style.backgroundColor = bgcolor;
	document.getElementById( "cdprice" + no ).style.color = fgcolor;
document.getElementById( "cdprice" + no ).style.backgroundColor = bgcolor;
}

function cd_onmouseout(no)
{
	// see /style/lincds.css for exact color combinations and
	// MUST be SAME as in this file for
	// td.cdname, td.cdno, td.cdprice
	document.getElementById( "cdname"  + no ).style.color = "green";
document.getElementById( "cdname"  + no ).style.backgroundColor = "white";
	document.getElementById( "cdno"    + no ).style.color = "red";
document.getElementById( "cdno"    + no ).style.backgroundColor = "white";
	document.getElementById( "cdprice" + no ).style.color = "blue";
document.getElementById( "cdprice" + no ).style.backgroundColor = "white";
}
