Try to avoid the global variable in the javascirpt code. Instead of that use the method objects.
var name = 'Jeffrey';
var lastName = 'Way';
var lastName = 'Way';
function doSomething() {...}
Better way of writing the code.
var DudeNameSpace =
{
name :'Bala',
lastname:'Subramaniyam',
doSumething : function()
{
//do something
}
}
}