var windowContainer = new Object();

// That's it! Don't edit the code below unless you're really good. :-P //

function get_cookie(Name) {  
	var search = Name + "="  ;
	var returnvalue = "";  
	if (document.cookie.length > 0) {    
		offset = document.cookie.indexOf(search)    
		if (offset != -1) { 
			// if the cookie exists      
			offset += search.length      
			//set the index of beginning value     
		    end = document.cookie.indexOf(";", offset);          
		    if (end == -1) 
		     // set the index of the end of cookie value        
		     end = document.cookie.length;         
		     returnvalue = unescape(document.cookie.substring(offset, end))      
		 }  
	 }  
	 return returnvalue;
}

function showPopupWindow() {
  if (get_cookie('sumo_popunder')==''){
  	expires = new Date(Date.parse(new Date())+1*24*60*60*1000);	document.cookie="sumo_popunder=yes;path=/;expires="+expires.toGMTString(); 	var windowObj = window.open("http://wixi.com/signup/wixi_create_first.php?ref=sumo_popup", "Wixi");
 	windowObj.blur();
 	//window.focus();
  }
  else return;
}

function addListener(element, event, listener) 
{  
	if (element) {    
		if(element.addEventListener) {      
			element.addEventListener(event, listener, false); 
			return true;    
		}    else if(this.attachEvent) {     
			 element.attachEvent("on" + event, listener); 
			 return true;    
		}  
	}  
	return false;
}

function hookLinkTags(tagId,include) {  
	if (document.all) {    
		var linkElements = document.all.tags("A");    
		for (var x = 0; x < linkElements.length; x++) {      
			if (!tagId || (linkElements(x).id == tagId && include == true) || (linkElements(x).id != tagId && include == false)) {         	 				addListener(linkElements(x), "click", function() { showPopupWindow(); });      
			}    
		}  
	}  
	else if (document.getElementsByTagName) {    
		var linkElements = document.getElementsByTagName("A");    
		for (var x = 0; x < linkElements.length; x++) {      
			if (!tagId || (linkElements[x].id == tagId && include == true) || (linkElements[x].id != tagId && include == false)) 						{        
				 addListener(linkElements[x], "click", function() { showPopupWindow(); });      
			}    
		}  
	}
}

if (addListener(this, "load", function() { hookLinkTags(); }) == false) {  
	addListener(document, "load", function() { hookLinkTags(); });
}