function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
	function popupWindow (url, windowName, width, height) {
	var siteWindow = null;
		if (!siteWindow || siteWindow.closed) {
			this.name = 'main';
			siteWindow = window.open(url,windowName,'toolbar=no,width='+width+',height='+height+',status=no,scrollbars=yes,resize=yes,menubar=no,left=20,top=20')
		}
		siteWindow.focus();
	}
	function popupWindowWithPosition (url, windowName, width, height, left, top) {
	var siteWindow = null;
		if (!siteWindow || siteWindow.closed) {
			this.name = 'main';
			siteWindow = window.open(url,windowName,'toolbar=no,width=517,height=520,status=no,scrollbars=yes,resize=yes,left='+left+',top='+top+'menubar=no')
		}
		siteWindow.focus();
	}
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=680,height=600,left = 390,top = 100');");
}
// End -->


// Function to toggle the visibility of a div
function toggleVis(obj) {		
        var el = document.getElementById(obj);
		if (el.style.visibility=="hidden"){
			el.style.visibility="visible";
			}
		else {
			el.style.visibility="hidden";
			}		
		}
// Enf toggle vis function

// Function to create a cookie - used for behavioral targeting/ site survey
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
		window.location.reload();
	}
	else var expires = "";
	document.cookie = name + "=" + value + expires + "; path=/";
	window.location.reload();
}
// End Create Cookie function

// Function to delete a cookie - used for testing purposes
function eraseCookie(name) {
	createCookie(name,"",-1);
	window.location.reload();
}
// End Delete Cookie function

// Function accepts a cookie name and returns its paired value
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
// End get cookie value funtion

// Accepts a cookie name and div name and swaps content in the div based on the result of the cookie
function switchDiv(c_name,d_name) {
	var c_value = getCookie(c_name);
	if (c_value != 'nothanks') {
		var newdiv =  d_name + '-' + c_value;
		var defaultdiv = d_name + '-default';
		var s_div = document.getElementById(newdiv);
		var d_div = document.getElementById(defaultdiv);
		s_div.style.visibility="visible";
		s_div.style.display="block";
		d_div.style.visibility="hidden";
		d_div.style.display="none";
	}
}
// End div swap function

// This function checks if the survey cookie has been set and if it is (survey has been taken) hides it from the user
function checkSurvey(){
	var surveydiv=document.getElementById("sunward-survey"); 
	var ie6surveydiv=document.getElementById("sunward-survey-ie6"); 
	c_value=getCookie('sunsurvey');
	if (c_value!=null && c_value!="") {
  		surveydiv.style.visibility="hidden";
		ie6surveydiv.style.visibility="hidden";
		ie6surveydiv.style.display="none";
  	}
}
// end check cookie function


// *********************** FUNCTIONS FOR DYNAMIC CONTENT SWAPPING ON LANDING PAGES *********************** //

// This function parses the URL string a builds Variable/Assignment pairs
function getVars() {   
   document.$_GET = [];
   var urlHalves = String(document.location).split('?');
   
   if(urlHalves[1]){
      var urlVars = urlHalves[1].split('&');
      for(var i=0; i<=(urlVars.length); i++){
         if(urlVars[i]){
            var urlVarPair = urlVars[i].split('=');
            document.$_GET[urlVarPair[0]] = urlVarPair[1];
         }
      }
   }  
}
// End URL Parser

// This function accepts a XML file name, loads the content into a javascript object, and returns it
function loadXMLDoc(dname) {
	document.write(dname + '<br />');
	if (window.XMLHttpRequest) {
  		xhttp=new XMLHttpRequest();
		document.write(' is a xmlrequest <br />');
  	} else {
  		xhttp=new ActiveXObject("Microsoft.XMLHTTP");
		document.write(' is an activex object <br />');
  	}
	xhttp.open("GET",dname,false);
	xhttp.send();
	return xhttp.responseXML;
}
// End XML Loader

// This function references the specified URL variable assignment, pulls the correct content from the xml object and swaps the content on the page
function swapContent() {
	//pull the variable from the url
	getVars();
	var cmv = document.$_GET['cm_mmc'];
		
		if(document.$_GET['cm_mmc']) {	
			//sanitize it - isolate just the bit we want and turn it to all lower case letters
			cmv = cmv.toLowerCase();
			var cmva = new Array();
			cmva = cmv.split('-_-');
			var cmvs = cmva[2];	// this assumes the ad group will always be in the third position			
			//run through the xml file to find the node that marches the url variable
			xmlDoc=loadXMLDoc('content/includes/test.xml'); 
			z=xmlDoc.getElementsByTagName("section");
						
			for (i=0;i<z.length;i++) {
				if (z[i].attributes[0].nodeValue == cmvs) {
					//do something
					document.getElementById("inq-dynamic-headline").innerHTML=xmlDoc.getElementsByTagName("headline")[i].childNodes[0].nodeValue;
					// document.getElementById("copy").innerHTML='<p>' + xmlDoc.getElementsByTagName("copy")[i].childNodes[0].nodeValue + '</p>';
					//document.getElementById("inq-state-image").innerHTML='<img src="' + xmlDoc.getElementsByTagName("image")[i].childNodes[0].nodeValue + '" />';	
				}
  			}					
		}	
}
// End Content Swapper



