/************************************************************************/
/* RankQuest: Search Engine Optimization Tools                          */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2006 by RankQuest                                      */
/* http://www.rankquest.com                                             */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/*                                                                      */ 
/* This program is distributed in the hope that it will be useful, but  */ 
/* WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU     */
/* General Public License for more details                              */ 
/************************************************************************/

function changeOption(id){
	if(id == "localfile"){
    	var url = document.getElementById('urlSelectBox');
       	var urlVal = url.options[url.selectedIndex].value;
       	document.getElementById('urlSelect').style.display = 'none';
       	document.getElementById('fileSelect').style.display = 'block';
		document.getElementById('enterFile').selected = true;
	}else{	
    	var files = document.getElementById('fileSelectBox');
       	var filesVal = files.options[files.selectedIndex].value;
       	document.getElementById('fileSelect').style.display = 'none';
       	document.getElementById('urlSelect').style.display = 'block';
		document.getElementById('enterUrl').selected = true;
    }
}

function Trim(str){
	while(str.charAt(0) == (" ") ){
		str = str.substring(1);
	}
	while(str.charAt(str.length-1) == " " )	{
		str = str.substring(0,str.length-1);
	}
	return str;
}

function set(){
        document.feed.url.focus();
}

function validateNotNull(){
	var value = 0;
	var i = 0;
    if(document.feed.url.value=="") {
    	alert("Please enter a URL");
        document.feed.url.focus();
        return false;
    }else{
		url = Trim(document.feed.url.value);
        if(url.length > 150){
            alert("Sorry we support only URL upto length 150 ");
			document.feed.url.value = "";
			document.feed.url.focus();
            return false;
        }else{
            for(i=0;i<url.length;i++){
                if(url[i]==" "){
                	value = 1;
                    break;
    	        }
        	}
	        if(value == 1){
    	        alert("Invalid URL. Please check the URL ");
				document.feed.url.value = "";
				document.feed.url.focus();
	            return false;
    	    }
			document.feed.url.value = url;
	        return true;
    	}
    }
}


