function confirm_delete(formname)
{

input_box=confirm("Click OK or Cancel to Continue\r\rAre you sure you want to delete?");

	if (input_box==true){ 
		eval("document." + formname + ".entry.name='delete_entry';");		
		eval("document.forms['" + formname + "'].submit();");
	}else{
		return false;
	}

}



function confirm_cart(formname)
{

input_box=confirm("Are you sure you want to remove this item from the cart?\r\rClick OK to remove it or Cancel to keep it.");

	if (input_box==true){
		eval("document.forms['" + formname + "'].submit();");
	}else{
		return false;
	}

}

function confirm_generic(msg, formname)
{

input_box=confirm(msg);

	if (input_box==true){
		eval("document.forms['" + formname + "'].submit();");
	}else{
		return false;
	}

}

function confirm_forward(msg,URL)
{

input_box=confirm(msg);

	if (input_box==true){
		eval("window.location='" + URL + "';");
	}else{
		return;
	}
	
}

function pop_guarantee(){

	eval("guarantee = window.open('http://myevent.com/popup.php?componentID=display_content&cont=ironclad_guarantee', 'guarantee', 'toolbar=1,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=450,height=550,left=200,top=50');");
		
}

function pop_guaranteeWebsiteworks(){

	eval("guarantee = window.open('http://websiteworks.com/popup.php?componentID=display_content&cont=ironclad_guarantee', 'guarantee', 'toolbar=1,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=450,height=550,left=200,top=50');");
		
}

function popup(URL){
	eval("privacy_policy = window.open(URL, 'privacy_policy', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=470,left=200,top=50');");
	privacy_policy.focus();
}


function popup_article(URL, width, height){
	eval("article = window.open(URL,'article', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=' + width + ',height=' + height + ',left=20,top=50');");
	article.focus();
}

function popup_bemail(URL){
	eval("edit_info = window.open('" + URL + "', 'imageDisplay', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=770,height=510,left=100,top=50')");
	edit_info.focus();
}

function popfact(URL,w,h,x,y){
	if(!w)
		var w = 550;
	if(!h)
		var h = 550;
	if(!l)
		var l= 20;
	if(!t)
		var t = 20;
	eval("facts = window.open('/popup.php?componentID=display_content&cont=" + URL +"', 'factDisplay', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + "');");
	eval("facts.resizeTo(w,h);");
	eval("facts.moveTo(x, y);");
	eval("facts.focus();");
}

function genericPop(content,w,h,l,t,s){
	if(!w)
		var w = 550;
	if(!h)
		var h = 550;
	if(!l)
		var l= 20;
	if(!t)
		var t = 20;
	if(!s)
		var s = 0;
	eval("miscContent = window.open('/popup.php?componentID=display_content&cont=" + content + "', 'miscContent', 'toolbar=1,scrollbars="  + s + ",location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + "');");
}


function popURL(URL,w,h,l,t,s){
	if(!w)
		var w = 550;
	if(!h)
		var h = 550;
	if(!l)
		var l= 20;
	if(!t)
		var t=20;
	if(!s)
		var s = 0;
	eval("miscContent = window.open('" + URL + "', 'miscContent', 'toolbar=1,scrollbars="  + s + ",location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h + ",left=" + l + ",top=" + t + "');");
}

function popitup(url) {
	newwindow=window.open(url,'name','height=550,width=450');
	if (window.focus) {newwindow.focus()}
	return false;
}

function show_hide(elem,lock){

	if(document.getElementById(elem + '_show_link')){
		var	showlink_el = document.getElementById(elem + '_show_link');
	}
	
	if(document.getElementById(elem + '_hide_link')){
		var	hidelink_el = document.getElementById(elem + '_hide_link');
	}
	var 	el = document.getElementById(elem);

	if(lock==1 && el.style.display=='none') // lock shut
		return;

	if(lock==2 && el.style.display!='none') // lock open
		return;

	if(el.style.display=='none'){
		el.style.display='block';
		if(document.getElementById(elem + '_hide_link'))
			hidelink_el.style.display='block';
		if(document.getElementById(elem + '_show_link'))
			showlink_el.style.display='none';
	}else{
		el.style.display='none';
		if(document.getElementById(elem + '_hide_link'))
			hidelink_el.style.display='none';
		if(document.getElementById(elem + '_show_link'))
			showlink_el.style.display='block';
	}
}

function cookie_show_hide(elem){
	var	showlink_el = elem + '_show_link';
	var	hidelink_el = elem + '_hide_link';
	var 	el = elem;
	var 	hideelem = document.getElementById(elem);
	if(hideelem.style.display == 'block'){
		Cookies.create(el,'block');
		Cookies.create(hidelink_el,'block');
		Cookies.create(showlink_el,'none');
	}else{
		Cookies.create(el,'none');
		Cookies.create(hidelink_el,'none');
		Cookies.create(showlink_el,'block');
	}
}


var Cookies = {
	init: function () {
		var allCookies = document.cookie.split('; ');
		for (var i=0;i<allCookies.length;i++) {
			var cookiePair = allCookies[i].split('=');
			this[cookiePair[0]] = cookiePair[1];
		}
	},
	create: function (name,value,days) {
	//	alert('called : ' + name);
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
		this[name] = value;
	},
	erase: function (name) {
		this.create(name,'',-1);
		this[name] = undefined;
	}
};
Cookies.init();


function maketransparent(){
	if(navigator.appVersion.indexOf("MSIE 6.")==-1)
		return;
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {

		 var meth = "scale";
		if(img.className == "titleimg") meth= "none";

		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='" + meth + "');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
}
if(window.attachEvent){
	window.attachEvent("onload", maketransparent);
}

function alternate(id){
	if(document.getElementById(id)){	
		if(document.getElementById){
			var table = document.getElementById(id);
			var rows = table.getElementsByTagName("tr");
			for(i = 0; i < rows.length; i++){			
				doAlternate(rows[i], i);
			}
		}
	}
}

function doAlternate(row, i){
	if(i % 2 == 0){
		row.className = "listTableGrey";
	}else{
		row.className = "listTableWhite";
	}
}


function showStep(step){
	var stepArray = new Array("stepHome", "step1", "step2", "step3");
	for(var i=0; i<stepArray.length; i++){
		thisStep = stepArray[i];
		if(thisStep == "stepHome"){
			document.getElementById("stepHome").style.display="block";
			document.getElementById("stepHome" + "_btn").style.visibility="hidden";
		}

		if(thisStep!=step){
			document.getElementById(thisStep).style.display="none";
			document.getElementById(thisStep + "_btn").style.visibility="visible";
		}else{
			document.getElementById(thisStep).style.display="block";
			document.getElementById(thisStep + "_btn").style.visibility="hidden";
		}
	}
}

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
		anchor.target = "_blank"; 
	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "help_window"){
		anchor.target = "help_window"; 
	}
 } 
}

function view_my_site(url){
	var viewMySite = open('http://www.' + url, 'viewMySite');
	if(viewMySite)
		viewMySite.focus();	
}


function CreateBookmarkLink() {
	var url = "http://www.myevent.com/login.php";
	var title = "Login to My Web Site";
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
		} else if( window.external ){ // IE Favorite
			window.external.AddFavorite( url, title); 
			}else if(window.opera && window.print) { // Opera Hotlist
				return true;
				 }
 } 


function openWin(URL) {
	awindow = window.open(URL,"thewindow","width = 850, height = 750, scrollbars = yes, location=yes, directories=no,  copyhistory=yes, status=yes, menubar=yes, resizable = yes,toolbar=yes");
}


//function employed by code that would stop right clicking on a page.
function right(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
		alert("Sorry, you do not have permission to right click.");
		return false;
	}
return true;
}

function navigate_ecom(cmp,subpage){
	ecomLink = document.getElementsByTagName("form")[1];
	ecomLink.action="?componentID=" + cmp + "&page=7&subpage=" + subpage;
	ecomLink.submit()
	}
	
	
function adjustForScreen(){
	var w = screen.width;
	if(w < 1030){
		document.getElementById('container_container').style.width = "1000px";
		document.getElementById('big_container').style.left = "-15px";
		if(document.getElementById('starting_at'))
			document.getElementById('starting_at').style.left = "875px";
		if(document.getElementById('free_trial_sticker'))
			document.getElementById('free_trial_sticker').style.left = "875px";
	}
}


function showStep(step){
	var stepArray = new Array("sellFirst","sellStepOne", "sellStepTwo", "sellStepThree", "homeStepOne", "homeStepTwo", "homeStepThree", "stepFirst");
	for(var i=0; i<stepArray.length; i++){
		thisStep = stepArray[i];
		if(thisStep!=step){
			if(document.getElementById(thisStep + "_btn"))
				document.getElementById(thisStep + "_btn").style.visibility="visible";
		}else{
			if(document.getElementById(thisStep + "_btn"))
				document.getElementById(thisStep + "_btn").style.visibility="hidden";
		}
	}
}

function changeState(btn){
	var btnArray = new Array("optionOne_btn", "optionTwo_btn", "optionThree_btn");
	for(var i=0; i<btnArray.length; i++){
		thisBtn = btnArray[i];
		if(document.getElementById(thisBtn)){
			if(thisBtn!=btn){
				document.getElementById(thisBtn).className=thisBtn + "_closed";
			}else{
				document.getElementById(thisBtn).className=thisBtn + "_open";
			}
		}
	}

}

function displayTip(n){return "<div class='display_hint'>" + HINTS_ITEMS[n] + "</div>"}

function pop_promo_mw(){eval("promo=window.open('http://makeswebsites.com/popup.php?componentID=display_content&cont=promo_july', 'promo', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=710,height=465,left=200,top=0');");}

