var baseHref = "http://www.i-am-bored.com";
var mediaBaseHref = "http://cdn-www.i-am-bored.com";
if (document.domain == "staging.i-am-bored.com")
{
	baseHref = "http://staging.i-am-bored.com";
	mediaBaseHref = "http://staging.i-am-bored.com";
}

function addBookmark(title,url) 
{
	if (window.sidebar) 
	{ 
		window.sidebar.addPanel(title, url,""); 
	} 
	else if ( document.all ) 
	{
		window.external.AddFavorite( url, title);
	} 
	else if ( window.opera && window.print ) 
	{
		return true;
	}
}

function MM_preloadImages() 
{ 	// v3.0
  	var d=document; 
	
	if(d.images)
	{ 
		if(!d.MM_p) 
		{
			d.MM_p=new Array();
		}
		
    	var i, j=d.MM_p.length, a=MM_preloadImages.arguments; 
	
		for(i=0; i<a.length; i++)
		{
			if (a[i].indexOf("#")!=0)
			{ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
		}
	}
}

function land(ref, target)
{
	lowtarget=target.toLowerCase();
	
	if (lowtarget=="_self") 
	{
		window.location=loc;
	}
	else 
	{
		if (lowtarget=="_top") 
		{
			top.location=loc;
		}
		else 
		{
			if (lowtarget=="_blank") 
			{
				window.open(loc);
			}
			else 
			{
				if (lowtarget=="_parent") 
				{
					parent.location=loc;
				}
				else 
				{
					parent.frames[target].location=loc;
				}
			}
		}
	}
}

function jump(menu)
{
	ref=menu.choice.options[menu.choice.selectedIndex].value;
	splitc=ref.lastIndexOf("*");
	target="";
	
	if (splitc!=-1)
	{
		loc=ref.substring(0,splitc);
		target=ref.substring(splitc+1,1000);
	}
	else 
	{
		loc=ref; 
		target="_self";
	}
	
	if (ref != "") 
	{
		land(loc,target);
	}
}

function popUp(URL,windowName,width,height) {	
    var features =
        'width='        + width +
        ',height='      + height +
        ',location=no' +
        ',menubar=no' +
        ',scrollbars=no' +
        ',status=no' +
        ',toolbar=no' +
        ',resizable=yes,top=10,left=10';

    window.open (URL, windowName, features);
}

function getCookieVal (offset) 
{  
	var endstr = document.cookie.indexOf (";", offset); 
	
	if (endstr == -1)
	{
		endstr = document.cookie.length;  
	}
	
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	
	while (i < clen) 
	{    
		var j = i + alen; 
		
		if (document.cookie.substring(i, j) == arg)
		{
			return getCookieVal (j);    
		}
		
		i = document.cookie.indexOf(" ", i) + 1;   
		
		if (i == 0) 
		{
			break;
		}
	} 
	
	return null;
}

function loginBar()
{
	my_handle = GetCookie('handle');
	
	if (!my_handle)
	{
		my_handle = GetCookie('HANDLE');	
	}
	
	ytk = GetCookie('yt%5Fkey');
	iab_user_id = GetCookie('iab%5Fuser%5Fid');
	uc = iab_user_id * 577;
	ucc = iab_user_id * 23;

	if (my_handle) 
	{
		if (my_handle) 
		{
			document.write('Hi, <b>' + my_handle + '</b>! <nobr><a href="log_out.asp" rel="nofollow">Log Out</a> | <a href="edit_profile_iab.asp" rel="nofollow">My Account</a></nobr>');
		}
		else 
		{
			alert('There seems to be a problem with your cookies. Make sure they are enabled and try logging in again.');
		}
	}
	else 
	{
		document.write('<nobr><a href="login.asp" rel="nofollow">Log In</a> | <a href="new_acc.asp" rel="nofollow">New Account</a></nobr>');
	}
}

function check_search() {
	result = true;
	if (document.s_form.ss.value.length < 2) {
		alert("Please enter a string to search for");
		result = false;
	}
	return result;
}