<script language="JavaScript"><!--
isIE = false;
navVer = navigator.appVersion;
ver = parseFloat(navVer);
IEPos = navVer.indexOf('MSIE');
if (IEPos !=-1) {
  isIE = true;
  ver = parseFloat(navVer.substring(IEPos+5,navVer.indexOf(';',IEPos)));
}

isIE5up = (isIE && ver >= 5);

function setNSHomepage(URL) {  // this HAS to be signed if it is to run on the web
  var Text = '';
  Text += 'Due to Netscapes security handling, making this page your homepage, will show you a dialog with a warning.\n';
  Text += 'If you do not wish to grant this site the access to your browser settings,';
  Text += ' you can manually copy the current location and paste it in the location field in Edit / Preferences / Navigator.';
  if (confirm(Text)) {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");
    navigator.preference('browser.startup.homepage',URL);
  }
}
//-->
</script>
<script>
function chkemail(){
	email = document.subscription.email.value;
	if(email == '' || email == 'NULL'){
		alert('Email cannot be empty'); 
		return false;
	}

var i = 1;
var s=document.subscription.email.value;
var valid_chars = '%&*()\'\";:/';
for (i=0;i<s.length;i++){
    if (valid_chars.indexOf(s.charAt(i)) != -1){
         alert('please enter a valid Email address');
         return false;
     }
}
var sLength = document.subscription.email.value.length;
i=1;
while ((i < sLength) && (s.charAt(i) != "@")){
       i++;
}
if ((i >= sLength) || (s.charAt(i) != "@"))
   {
       alert('Please enter valid Email address');
       return false;
}
else i += 2;
   while ((i < sLength) && (s.charAt(i) != ".")){
        i++;
   }
if ((i >= sLength - 1) || (s.charAt(i) != "."))
{
    alert('please enter valid Email address');
    return false;
}

}
</script>

<script langauge=javascript>
<!--
function OpenMyWindow(gifName) {
	PreView = window.open(gifName, "", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=200,height=200");
	PreView.document.open();
	PreView.document.write("<HTML><HEAD><TITLE>Preview</TITLE></HEAD>");
	PreView.document.write("<BODY MARGINHEIGHT=0 MARGINWIDTH=0 TOPMARGIN=0 LEFTMARGIN=0 BGCOLOR='white' TEXT=000000 onLoad='self.resizeTo(document.MyImage.width+10, document.MyImage.height+29);' >");
	PreView.document.write("<IMG HSPACE=0 VSPACE=0 NAME=MyImage SRC='http://images.techtree.com/ttimages/site/" + gifName + "'>");
	PreView.document.write("</BODY></HTML>");
	PreView.document.close();
}
//-->
</script>

<Script>
<!--
function openwindow(url, wth, ht){
var para = "resizable=auto,scrollbars=auto, width=" + wth + ",height=" + ht;
window.open(url,"",para);
}
//-->
</Script>

<script language="javascript">
function validate2(){
var errMesg = "";
var charbag = "\!$^&()[]{}\\|;:\'\",<>\/?@";
var ErrorChar = "";
var defaultEmptyOK = false;
        if (document.search.q.value== null || document.search.q.value.length==0 || document.search.q.value=="Enter keyword")
        {
                 alert('please enter the search key');
                        return false;
        }
        var i = 1;
        var s=document.search.q.value;
        var valid_chars = charbag;
        for (i=0;i<s.length;i++)
        {
                if (valid_chars.indexOf(s.charAt(i)) != -1){
                        alert('please enter a valid search key');
                        return false;
                }
        }
        return true;
}
</script>
<script language="javascript">
function Call_Links () {
	var url = window.document.selectforum.subsection.options[window.document.selectforum.subsection.selectedIndex].value;
	window.document.selectforum.action=url;
	window.document.selectforum.submit();
	
}


</script>
<script language=JavaScript>
  <!--
  function validate_model()
  {
      if (document.speakout.message.value.length==0)
      {
        alert('please enter message');
        document.speakout.message.focus();
        return false;
      }
      if (document.speakout.display_name.value== null ||
         document.speakout.display_name.value.length==0)
      {
        alert('please enter your name');
        document.speakout.display_name.focus();
        return false;
      }
      if (document.speakout.city.value== null || document.speakout.city.value.length==0)
      {
        alert('please enter city');
        document.speakout.city.focus();
        return false;
      }
      if (document.speakout.email.value== null || document.speakout.email.value.length==0)
      {
        alert('please enter the Email address');
        document.speakout.email.focus();
        return false;
      }
      if (document.speakout.email.value != "")
      {
        var str=document.speakout.email.value;
        document.speakout.email.focus();
        var filter=/^.+@.+\..{2,3}$/;
 if (!filter.test(str))
        {
          alert("Please enter valid emailid");
          document.speakout.email.focus();
          return false;
        }
      }
  }
      //-->
</script>


<script>
	function RChange(RateNum,AID) 
	{ //v3.0
		var i=1
		RateNum = RateNum +1;
		for (i=1;i<=10;i++)
		{
			if (RateNum >= i) MM_changeProp('rating' + i + '_' + AID,'','src','http://images.itnation.com/ttimages/site/rating_over.gif','IMG');
			if (RateNum < (i+1)) MM_changeProp('rating' + i + '_'+ AID,'','src','http://images.itnation.com/ttimages/site/rating_off.gif','IMG');
		}
	}
	function MM_changeProp(objName,x,theProp,theValue) 
	{ //v6.0
		var obj = MM_findObj(objName);
		if (obj && (theProp.indexOf("style.")==-1 || obj.style))
		{
			if (theValue == true || theValue == false)
      				eval("obj."+theProp+"="+theValue);
    			else eval("obj."+theProp+"='"+theValue+"'");
		}
	}
	function MM_findObj(n, d) 
	{ //v4.01
		var p,i,x;  
		if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) 
		{
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			if(!x && d.getElementById) x=d.getElementById(n); return x;
		}

		function RateClick(RateNum,AID,sec) { //v3.0
		RateClickNum = RateNum;
		MM_changeProp('rating' + RateNum+'_' + AID,'','src',('http://www.techtree.com/techtree/jsp/ratingsInsert.jsp?rateval=' + RateNum + '&content_id=' + AID + '&section='+sec),'IMG');
		////MM_changeProp('rating' + RateNum+'_' + AID,'','src',('http://192.168.1.200/techtree/jsp/ratingsInsert.jsp?rateval=' + RateNum + '&content_id=' + AID + '&section='+sec),'IMG');
		var obj = MM_findObj('RateMe_'+AID );
		obj.title="Thanks";
		document.getElementById("ThanksMsg"+AID).style.display = "inline";
		obj.onmouseout=function rate(){};
		for (i=1;i<=10;i++)
		{
			obj= MM_findObj('rating'+i+'_' + AID );
			if(obj!=null)
 			{
				obj.onmouseover=function rate(){};
				obj.onmousedown=function rate(){};
				obj.title="Thanks";
			}
		}

	}

</script>

<script>
function isDefined(obj)
{
	return (typeof obj != 'undefined');
}


function ltrim(oldStr)
{
	var i = 0;
	var onlySpaces = 'y';

	while (onlySpaces == 'y')
	{
		if (oldStr.substring(i,i+1) != ' ')
		{
			onlySpaces = 'n';
			return(oldStr.substring(i,oldStr.length));
		}
		i++;
	}
}

function rtrim(oldStr)
{
	var i = oldStr.length;
	var onlySpaces = 'y';

	while (onlySpaces == 'y')
	{
		if (oldStr.substring(i-1,i) != ' ')
		{
			onlySpaces = 'n';
			return(oldStr.substring(0,i));
		}
		i--;
	}
}

function trim(oldStr)
{
	return(rtrim(ltrim(oldStr)));
}
</script>


<script language=javascript>
function validate1() {
	var errMesg = "";
	var charbag = "\!$^&()[]{}\\|;:\'\",<>\/?@";
	var ErrorChar = "";
	var defaultEmptyOK = false;

	if (isDefined(document.speakout.title.value) && (trim(document.speakout.title.value)== null || trim(document.speakout.title.value).length==0))
	{
		alert('please enter subject');
		document.speakout.title.focus();
		return false;
	}

	if (isDefined(document.speakout.comment.value) && (trim(document.speakout.comment.value)== null || trim(document.speakout.comment.value).length==0))
	{
		alert('please enter Comment');
		document.speakout.comment.focus();
		return false;
	}

	if (isDefined(document.speakout.name.value) && (trim(document.speakout.name.value)== null || trim(document.speakout.name.value).length==0))
	{
		alert('please enter name');
		document.speakout.name.focus();
		return false;
	}

	if (isDefined(document.speakout.city.value) && (trim(document.speakout.city.value)== null || trim(document.speakout.city.value).length==0))
	{
		alert('please enter city');
		document.speakout.city.focus();
		return false;
	}
	
	//if (document.forms[0].email.value== null || document.forms[0].email.value.length==0)
	if (isDefined(document.speakout.email.value) && (trim(document.speakout.email.value)== null || trim(document.speakout.email.value).length==0))
	{
		alert('please enter the Email address');
		document.speakout.email.focus();
		return false;
	}

	if (isDefined(document.speakout.email.value) && (document.speakout.email.value != ""))
	{
		var str=document.speakout.email.value;
		document.speakout.email.focus();
		var filter=/^.+@.+\..{2,3}$/;

		if (!filter.test(str))
		{
			alert("Please enter valid emailid");
			document.speakout.email.focus();
			return false;
		}
	}

	return true;
}
function clearFields()
{
	if (isDefined(document.speakout.title.value))
	{
		document.speakout.title.value="";
	}
	if (isDefined(document.speakout.comment.value))
	{
		document.speakout.comment.value="";
	}
	if (isDefined(document.speakout.name.value))
	{
		document.speakout.name.value="";
	}
	if (isDefined(document.speakout.city.value))
	{
		document.speakout.city.value="";
	}
	if (isDefined(document.speakout.email.value))
	{
		document.speakout.email.value="";
	}
}
</script>
<script>
<!--
function validate(theForm)
{
	if ( isDefined(theForm.email.value) && (trim(theForm.email.value) == ""))
	{
		alert("Please enter  Email id");
		theForm.email.value="";
		theForm.email.focus();	
		return false;
	}
	if (isDefined(theForm.email.value) && (theForm.email.value != ""))
	{
		var str=theForm.email.value
		var filter=/^.+@.+\..{2,3}$/
		if (!filter.test(str))
		{
			alert("Please enter valid emailid");
			theForm.email.focus();
			return false;
		}
	}
	if( isDefined(theForm.email.value) &&  trim(theForm.password.value) =="")
	{
		alert("Please enter your Password");
		theForm.password.value="";
		theForm.password.focus();
		return false;
	}	
	return true;
}
//-->
</script>

<!-- New code added by saradhi -->
<script>

function showRateMsg(rate) {
if (rate != 0) {
//hideAllErrors(rate);
document.getElementById("commentError"+rate).style.display = "inline";
return false;
}
return true;
}
 
function hideAllErrors(rate) {
document.getElementById("commentError"+rate).style.display = "none"
}


function showThanksMsg() 
{

document.getElementById("ThanksMsg").style.display = "inline";
return true;
}
 
function hideThanksMsg() {
document.getElementById("Thanks").style.display = "none"
}


function clearMsg(rate)
{
document.getElementById("commentError"+rate).style.display = "none"
}



function showStars()
{ //v3.0
            var i=1
                for (i=1;i<=10;i++)
                {
			 MM_changeProp('rating' + i + '_'+ 378740,'','src','http://images.itnation.com/ttimages/site/rating_off.gif','IMG');                      
                      
                }
        }

</script>

<!-- New code ended by saradhi -->


