/*Check for empty fields in form.
 *If there are empty fields than pop up a box
 *@param which - the form to be checked
 *@return boolean
*/

/* addition cell for home&garden articles, will be expired after april 18th, 2003 */
var Nav_text = "<tr><td valign='top' colspan='3'><img src='http://www.chatelaine.com/images/CPS/1007622.gif' border='0'></td></tr><tr> <td valign='top' width='2'>&nbsp;</td><td valign='top' width='6' class='body'>&#149;</td><td valign='top' width='142' class='body'><a href='http://community.chatelaine.com/fserver-jsp/18/?s=display'>Garden guru Yvonne Cunnington:</a> <b>April 14 to 18</b></td></tr>";

function checkForm(which){
	var pass=true;
	if (document.images){
		for (i=0;i<which.length;i++){
			var tempobj=which.elements[i];
			if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
				pass=false;
				break;
			}
		}
	}
	if (!pass){
		alert("One or more of the required fields are empty. Please fill them out and submit again!");
		return false;
	} else
		return true;
}

/*Check empty fields and email address*/
function checkFormAskEditor(_form){
	var reEmail=/\w+@\w+\.\w+/;	//must be an email address
	
	if (_form.YourName.value=='' || _form.comments.value==''){
		alert("One or more of the required fields are empty!");
		return false;
	}
	if (!reEmail.test(_form.Email.value)){
		alert("Invalid e-mail address!");
		return false;
	}
	return true;
}

function goX(item)
{
    if (item.selectedIndex == -1) return;
    for (var i=0; i<item.options.length; i++) 
    {
        if (item.options[i].selected == true)
        {
            val = item.options[i].value;
            if(val == "") return;
            else if(item.name=="healthLibrary")
            {
                part = val.split(",");
                if(part[1] == "sub") document.location="/health/library/index.jsp?library="+part[0]+"&feedName="+part[0]+"#"+part[2];
                else document.location="/health/library/index.jsp?library="+part[1]+"&feedName="+part[0];
            }
            else document.location=item.options[i].value;
        }
    }
}

function goXiwov(item)
{
    if (item.selectedIndex == -1) return;
    for (var i=0; i<item.options.length; i++) 
    {
        if (item.options[i].selected == true)
        {
            val = item.options[i].value;
            if(val == "") return;
            else document.location="/health/library/index.jsp?library="+item.options[i].value;
        }
    }
}
		/* simple mouseover function that changes the image */
		function changeImg(docImg,ImageOver) {
			if (document.images) {
			eval("document."+docImg+".src = ImageOver");
			}
		}

		/*open a location in a new browser window set at 440x500 in size*/
		function openWin(_url,_windowName) {
			newWin = window.open(_url,_windowName,"width=440,height=500,menubar=yes,statusbar=no,locationbar=no,toolbar=no,scrollbars=yes");
  			newWin.focus();
		}
 
		/*used in Adventure Central for jumping to a new page from a dropdown list without hitting a submit button*/
		function gotoPage(showform) {
			var listnum=showform.showmenu.selectedIndex;
			var htmlURL=showform.showmenu.options[listnum].value;
	
			if(htmlURL!="dead")       
				this.parent.location.href=htmlURL;  
 		}
 

		/*this is for just in case*/
		function checkBrowser(){
    			return true;
		}

function editContent(contentPath){
	var path = "http://interwoven2.rnm.ca/iw/webdesk/edit?vpath=/default/main/media/publishing/chatelaine_com/prod/WORKAREA/common/iw-web" + contentPath;
	window.open("/tools/winFrame.jsp?url="+path,"openContentWindow","width=2,height=2");
}

function editArticle(path){
	window.open("/tools/winFrame.jsp?url="+path,"openContentWindow","width=2,height=2");
}
