var xmlhttp;

function checkListBmark(str,cfunc)
{
	xmlhttp=GetXmlHttpObject();	
	if (xmlhttp==null)
	  {
	  alert ("Your browser does not support XMLHTTP!");
	  return;
	  }
	var url="/browser/blacklist_check.asp";
	url=url+"?domain="+str;	
    xmlhttp.onreadystatechange=cfunc;	
	xmlhttp.open("GET",url,true);			
	xmlhttp.send();

}


function checkList(str)
{

	xmlhttp=GetXmlHttpObject();
	
	if (xmlhttp==null)
	  {
	  alert ("Your browser does not support XMLHTTP!");
	  return;
	  }
	
	var url="/browser/blacklist_check.asp";
	url=url+"?domain="+str;
	
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

}

function stateChanged()
{
	if (xmlhttp.readyState==4)
	  {
	
	  // document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
	  // alert(xmlhttp.responseText);
	
	  var result = xmlhttp.responseText;
	
	  // alert(result);
	
	  if (result == "blocked"){
		 // parent.Content.location.href='http://yippy.com/browser/blocked.html'; }
		 parent.Content.location.href = yippy_config['redirect_blocked']; }
	
	  }
}

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}


var bV  = parseInt(navigator.appVersion);
var bNS = navigator.appName=="Netscape";
var bIE = navigator.appName=="Microsoft Internet Explorer";
var msg = "Please use the navigation controls at the top of the browser.";
function nrc(e){
	if (bNS && e.which > 1){
		alert(msg);
		return false;
	} else if (bIE && (event.button >1)){
		alert(msg);return false;
	}
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
if (bNS && bV<5) window.onmousedown = nrc;

var Now = document.location.search;

function doNow(){
	if (Now != "") {
	Now=Now.substring(1);
	document.Address.Entry.value = Now;
	}else{
	document.Address.Entry.value = 'http://';
	}
}


/*
var whereTo;
var parsing;
var badsites = new Array("http://porn.com","http://xxx.com","http://badstuff.com");

Array.prototype.inArray = function (value)
// Returns true if the passed value is found in the
// array. Returns false if it is not.
{
var i;
for (i=0; i < this.length; i++) {
// Matches identical (===), not just similar (==).
if (this[i] === value) {
return true;
}
}
return false;
};
*/
function urlencode(str) {
return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}

function goThere(){
	whereTo = '';
	whereTo = document.Address.Entry.value;
	parsing = whereTo.substring(0,7);
	parsing = parsing.toLowerCase();
	if (parsing != 'http://') whereTo="http://"+whereTo;
	// if (parsing == 'http://') whereTo = whereTo.substring(7);
	if (whereTo.length>12){
	        //parent.Content.location.href = "https://proxify.com/u?url="+urlencode(whereTo);
	        //parent.Content.location.href = "http://yippy.com/scrape.asp?url="+urlencode(whereTo);
		if (breakers(whereTo)) {
			var answer = confirm("The page you have requested is not YIPPY-compatible.  We'll go ahead and open it in a new window for you.")
			if (answer) {
			window.open(whereTo,'_blank') }
			if (!answer) {
			return false;  }
		} else {
		top.parent.Content.location.href = whereTo;  
		document.Address.Entry.value = whereTo;
		document.Address.action = 'navigation.html'+'?'+whereTo;
		}

		// if (badsites.inArray(whereTo)){
		// alert(checkList(whereTo));

		checkList(whereTo);
		
				

		/*
		if (checkList(whereTo) == "blocked"){
			parent.Content.location.href='http://yippy.com/browser/blocked.html'; }
		*/

	}
}

function myBmark()
{

	whereTo = '';
	whereTo = document.Address.Entry.value;
	parsing = whereTo.substring(0,7);
	parsing = parsing.toLowerCase();
	if (parsing != 'http://') whereTo="http://"+whereTo;
	
		checkListBmark(whereTo,function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
				if (xmlhttp.responseText== "blocked")
				{			
					parent.Content.location.href = yippy_config['redirect_blocked'];
				}
				else
				{					
					return GB_show('My Yippy Bookmarks', "/Userbookmark.asp","","300");		 
				}	
			}
		});
	
}

function myTab()
{

	whereTo = '';
	whereTo = document.Address.Entry.value;
	parsing = whereTo.substring(0,7);
	parsing = parsing.toLowerCase();
	if (parsing != 'http://') whereTo="http://"+whereTo;
	
		checkListBmark(whereTo,function()
		{
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{	
				if (xmlhttp.responseText== "blocked")
				{			
					parent.Content.location.href = yippy_config['redirect_blocked'];
				}
				else
				{					
					return GB_show('My Yippy Tabs', "../UserTab.asp","","300");		 
				}	
			}
		});
	
}




function breakers(urlbreak) {

	var framebreak = new Array("http://facebook.com","http://myspace.com","http://twitter.com","http://answers.com","http://walmart.com","http://photobucket.com","http://paypal.com","http://nbcolympics.com","http://hulu.com","http://apple.com","http://snopes.com","http://chase.com","http://bankofamerica.com","http://nytimes.com","http://ups.com","http://ign.com","http://socialcash.com","http://zynga.com","http://causes.com","http://wellsfargo.com","http://evite.com","http://metacafe.com","http://wikia.com","http://capitalone.com","http://zimbio.com","http://mybloglog.com","http://twitpic.com","http://pogo.com","http://toysrus.com","http://expedia.com","http://squidoo.com","http://ebay.com","http://newsweek.com","http://scribd.com","http://tumblr.com","http://hrblock.com","http://yahoo.com","http://mail.yahoo.com","http://ezinearticles.com","http://nick.com","http://kbb.com","http://lycos.com","http://angelfire.com","http://tvguide.com","http://shopping.com","http://wildgames.com","http://t-mobile.com","http://familylink.com","http://sfgate.com","http://buy.com","http://sprint.com","http://usatoday.com","http://intuit.com","http://slide.com","http://kmart.com","http://alibaba.com","http://fidelity.com","http://weather.gov","http://popularscreensavers.com","http://intelius.com","http://encyclopedia.com","http://gamestop.com","http://nba.com","http://gap.com","http://drugs.com","http://rr.com","http://shutterfly.com","http://local.com","http://softpedia.com","http://myway.com","http://gifts.com","http://ovguide.com","http://vistaprint.com","http://webfetti.com","http://ustream.tv","http://sprintpcs.com","http://sprint.com","http://homestead.com","http://gizmodo.com","http://stumbleupon.com","http://wachovia.com","http://www.facebook.com","http://www.myspace.com","http://www.twitter.com","http://www.answers.com","http://www.walmart.com","http://www.photobucket.com","http://www.paypal.com","http://www.nbcolympics.com","http://www.hulu.com","http://www.apple.com","http://www.snopes.com","http://www.chase.com","http://www.bankofamerica.com","http://www.nytimes.com","http://www.ups.com","http://www.ign.com","http://www.socialcash.com","http://www.zynga.com","http://www.causes.com","http://www.wellsfargo.com","http://www.evite.com","http://www.metacafe.com","http://www.wikia.com","http://www.capitalone.com","http://www.zimbio.com","http://www.mybloglog.com","http://www.twitpic.com","http://www.pogo.com","http://www.toysrus.com","http://www.expedia.com","http://www.squidoo.com","http://www.ebay.com","http://www.newsweek.com","http://www.scribd.com","http://www.tumblr.com","http://www.hrblock.com","http://www.yahoo.com","http://www.mail.yahoo.com","http://www.ezinearticles.com","http://www.nick.com","http://www.kbb.com","http://www.lycos.com","http://www.angelfire.com","http://www.tvguide.com","http://www.shopping.com","http://www.wildgames.com","http://www.t-mobile.com","http://www.familylink.com","http://www.sfgate.com","http://www.buy.com","http://www.sprint.com","http://www.usatoday.com","http://www.intuit.com","http://www.slide.com","http://www.kmart.com","http://www.alibaba.com","http://www.fidelity.com","http://www.weather.gov","http://www.popularscreensavers.com","http://www.intelius.com","http://www.encyclopedia.com","http://www.gamestop.com","http://www.nba.com","http://www.gap.com","http://www.drugs.com","http://www.rr.com","http://www.shutterfly.com","http://www.local.com","http://www.softpedia.com","http://www.myway.com","http://www.gifts.com","http://www.ovguide.com","http://www.vistaprint.com","http://www.webfetti.com","http://www.ustream.tv","http://www.sprintpcs.com","http://www.sprint.com","http://www.homestead.com","http://www.gizmodo.com","http://www.stumbleupon.com","http://www.wachovia.com","http://gmail.com","http://www.gmail.com","http://mail.google.com","http://www.mail.google.com");

	var i=0;
	for (i=0;i<=(framebreak.length-1);i++)  {
	   if (urlbreak == framebreak[i]) {
	      return true;
	   }
	}
	return false;
}








function doClear(){
	document.Address.Entry.value = "http://";
}

function doNada(){
	parent.Content.focus();
}

//Refresh Function For Browser

function Reload () {
goThere();
var f = document.getElementById('Content');
f.src = document.Address.Entry.value;
}

//Stop Function For Browser

function stopLoad() {
	var browserName=navigator.appName;
	if (browserName=="Netscape")
	{
	//alert("stopping Netscape");
	 window.stop();
	 document.execCommand("Stop");
	} 
	else
	{
	 if (browserName=="Microsoft Internet Explorer")
	 {
	 	//alert("stopping IE");
	  document.execCommand("Stop");
	 }
	 else
	  {
	  //alert("stopping"+browserName);
		window.stop();
	   }
	}
	}
