var server_path = 'http://www.chip.in/';
function makeemptyuser() 
{
	if(document.login.username.value == "username")
	{
		document.login.username.value="";
	}
}
function makeemptypassword() 
{
	if(document.login.password.value == "password")
	{
		document.login.password.value="";
	}
}

function printpage(id, type)
{
	var print_url=server_path+"print_this.php?id="+id+"&type="+type+"";
	window.open(print_url,"viewgiftproducts","width=600,height=580,top=5,left=5,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=yes,statusbar=yes");
}
function emailpage(id, type)
{
	var email_url=server_path+"email_this.php?id="+id+"&type="+type+"";
	window.open(email_url,"viewgiftproducts","top=10,left=10,width=420,height=600,resizable=no,scrollbars=no");
}

function valButton(btn) 
{
	var cnt = -1;
	for (var i=btn.length-1; i > -1; i--) 
	{
		if (btn[i].checked)
		{
			cnt = i; i = -1;
		}
	}		
	if (cnt > -1)
		return btn[cnt].value;
	else 
		return null;
}


function pollresult(validate)
{
	if(validate == 1)
	{
		var btn = valButton(document.frmpoll.option);
		if (btn == null)
		{
			alert('Please select an option');
			return false;
		}
	 
	}
	
	window.open(server_path+"pollresults.php?option="+btn,"viewgiftproducts","top=0,left=0,width=420, height=450, resizable=no,scrollbars=no");
}

function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function survey_page()
{
	document.user_survey.action="survey/survey_landing.php";
	document.user_survey.target="_blank";
	document.user_survey.submit();
}

function ValidateForm_search()
{
	if(document.frmsearch.q.value=="")
	{
		alert("Enter the Search Keyword");
		return false
	}
	str = document.frmsearch.q.value.trim();
	if(str == "")
	{
		alert("Enter the Search Keyword");
		document.frmsearch.q.value="";
		document.frmsearch.q.focus();
		return false
	}
	document.frmsearch.submit();
}
String.prototype.trim = function() 
{
	return this.replace(/^\s+|\s+$/, ''); 
};
