function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}

function validateEmail(email)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		return true;
	else
		return false;	
}
function validateRegisterForm()
{
	var msg = '';
	if (findObj('username').value =='')
		msg = msg + 'Enter user name\n';
	
	if (findObj('password').value =='')
		msg = msg + 'Enter password\n';
	
	if (findObj('email').value =='')
		msg = msg + 'Enter email\n';
		
	if (findObj('password').value != findObj('cpassword').value)
		msg = msg + 'Password and confirm password must be identical\n';
	
	if (!validateEmail(findObj('email').value))
		msg = msg + 'Email address is not valid\n';
		
	if (msg == '')
		return true;
		
	alert(msg);
	return false;	
}

function msg(n)
{
	switch(n)
	{
		case 1:
			alert('You have to login to Rssfeeds.co.il before you can add this feed to your channels.');
			break;
	}
}

function newwin(url,w,h)
{
	window.open(url, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+w+',height='+h);
}

function bookmarksite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}