var partner = ""
var partner_folder = ""
var tots_exist = 0
var tapes_exist = 0
var ax_ver = "0"
var sb_ver = "0"
var sb = "0"
var enc_pass = ""
var allow = 0
var tot_frames=0
var tot_minutes=0
var tot_hours=0
var tot_tapes=0
var tot_tapes_encoded=0
var tot_tapes_not_encoded=0
var new_tape_code = new Array ()
var new_tape = new Array ()
var new_tape_title = new Array ()
var new_tape_name = new Array ()
var new_tape_bitrate = new Array ()
var new_tape_length = new Array ()
var new_tape_notes = new Array ()
var new_tape_webmovie_path = new Array ()
var new_tape_start = new Array ()
var new_tape_end = new Array ()
var new_tape_type = new Array ()
var new_tape_drive = new Array ()
var new_tape_status = new Array()
var ship_tape_code = new Array ()
var ship_tape_name = new Array ()
var keep_tape_code = new Array ()
var keep_tape_name = new Array ()
var active_tapes = new Array ()
var active_tapes_path = new Array ()
var people_list = new Array ()
var people_activity = new Array()
var afiniti_totals = new Array ()
var active_tape_counter = 0
var people_count=0
var share_people=0
var tape_cntr=0
var people_cntr=0
var total_activity=0
var people_most = 0
var snapshot_menu=1
var unloading=0
var	short_video_length = 0
var ship_items = 0
var what_tut=1
var what_help=1
var roll_id = ""
var last_active = ""
var hold_chr = ""
var hold_chr1 = ""
var hold_chr2 = ""

var current_date = new Date()
var current_month = (current_date.getMonth()+1)
var current_day = current_date.getDate()
var current_year = current_date.getFullYear()
var order_date = (current_month+"/"+current_day+"/"+current_year)
var order_status = 1
var trans_code = ""
var bad_validate = 0
var error = 0
var referral = ""
var conf_code = ""
var share_id = ""
var share_fname = ""
var sb_code = ""
var type=""
var show_contact=0
var chg_pass = 0

var player = null

var cust_aff = ""
var cust_start = ""
var cust_share = ""
var stash_cash_tot = ""
var cust_level = ""
var activation_key1 = ""
var activation_key2 = ""
var activation_key = new Array()
var cust_set = new Array()
var level_hist_date = new Array()
var level_hist_user = new Array()

var signupWin = null
var whyphoneWin = null
var mobileWin = null
var policyWin = null
var orderWin = null
var hist_win = null

var order_time = 0
var order_cntr = 0


function swap_image2(id,state)
{
var folder=""
try
	{
	var current_pathname = String(document.location.pathname)
	if(current_pathname.indexOf("partners") > -1 && current_pathname.indexOf("demo") < 0)
		{
		folder = "/partners"
		}
	else
		{
		folder = partner_folder
		}
	document.getElementById(id).src = folder + ("/images2/" + id + "-" + state + ".gif")
	}
catch(err)
	{
	return
	}
}


function show_what_is(layer_id,obj,adjl,adjt)
{
var layer = document.getElementById(layer_id)
var curleft = curwidth = curtop = adjleft =adjtop = 0;
curwidth = obj.width
if(curwidth == "") curwidth = 55
if(adjl) adjleft = adjl
if(adjt) adjtop = adjt

if (layer.style.visibility == "hidden")
	{
	if (obj.offsetParent)
		{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) 
			{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
			layer.style.top = (eval(curtop) + eval(adjtop)) + "px"
			layer.style.left = (eval(curleft) + eval(curwidth) - eval(adjleft)) + "px"
			layer.style.visibility = 'visible'
			}
		}
	}
else
	{
	layer.style.visibility = 'hidden'
	}
}

function close_what_is(layer)
{
document.getElementById('what_is_'+layer).style.visibility = "hidden"
}

//My Account stuff//

function load_acct_info()
{
if(!GetCookie('homemovie'))
	{
	alert("You do not seem to be logged in.  You must be logged in to retrieve account information.")
	return
	}

var acct_chr = ""
var options = ("height=630,width=700,location=0,directories=0,menubar=0,resizable=1,left=50,top=100,scrollbars=0,status=1,statusbar=1,toolbar=0,titlebar=0")

if((document.location.host).indexOf("thinkpad") > -1 || document.location.host=="dev.stashspace.com" || document.location.host=="qa.stashspace.com")
	{
//	acct_chr = ("https://www.stashspace.com/secure/chg_acct_info.htm")
	acct_chr = ("/secure/chg_acct_info.htm")
	}
else
	{
	acct_chr = ("https://www.stashspace.com/secure/chg_acct_info.htm")
	}
acct_window = window.open(acct_chr,"AccountInformation",options)
//acct_time = window.setInterval("page_refresh()",3000)

}

function load_history()
{
if(!GetCookie('homemovie'))
	{
	alert("You do not seem to be logged in.  You must be logged in to retrieve order history.")
	return
	}

var this_height = screen.availHeight
var hist_chr = ("/my-account/order-history.stm")
var options = ""

if(this_height < 810)
	{
	options = ("height="+this_height+",width=710,location=0,directories=0,menubar=0,resizable=1,left=100,top=0,scrollbars=1,status=0,statusbar=0,toolbar=0,titlebar=0")
	}
else
	{
	options = ("height=810,width=710,location=0,directories=0,menubar=0,resizable=1,left=100,top=0,scrollbars=0,status=0,statusbar=0,toolbar=0,titlebar=0")
	}

if(hist_win == null)
	{
	hist_win = window.open(hist_chr,"OrderHistory",options)
	}
else if(hist_win.closed == false)
	{
	hist_win.focus()
	}
else
	{
	hist_win = window.open(hist_chr,"OrderHistory",options)
	}
}

function load_statement()
{

var options = ("height=600,width=575,location=0,directories=0,menubar=0,resizable=1,left=100,top=100,scrollbars=0,status=0,statusbar=0,toolbar=0,titlebar=0")

var statement_chr = ("/summary-statement.stm?" + code)
window.open(statement_chr,"ActivityStatement",options)

}

function page_refresh()
{
if (acct_window.closed)
	{
	window.clearInterval(acct_time)
	account_window = null
	var cookie_array = new Array()
	cookie_array = GetCookie("homemovie").split("~")
	// alert(cookie_array)
	if(cookie_array[2] != pass)
		{
		window.location.reload()
		}
	}
}


function set_layer_vis(setting,layer1,layer2,layer3,layer4,layer5,layer6,layer7,layer8,layer9,layer10,layer11,layer12,layer13,layer14,layer15,layer16,layer17,layer18,layer19,layer20)
{
var layer_ids = new Array()
if(layer1) layer_ids.push(layer1)
if(layer2) layer_ids.push(layer2)
if(layer3) layer_ids.push(layer3)
if(layer4) layer_ids.push(layer4)
if(layer5) layer_ids.push(layer5)
if(layer6) layer_ids.push(layer6)
if(layer7) layer_ids.push(layer7)
if(layer8) layer_ids.push(layer8)
if(layer9) layer_ids.push(layer9)
if(layer10) layer_ids.push(layer10)
if(layer11) layer_ids.push(layer11)
if(layer12) layer_ids.push(layer12)
if(layer13) layer_ids.push(layer13)
if(layer14) layer_ids.push(layer14)
if(layer15) layer_ids.push(layer15)
if(layer16) layer_ids.push(layer16)
if(layer17) layer_ids.push(layer17)
if(layer18) layer_ids.push(layer18)
if(layer19) layer_ids.push(layer19)
if(layer20) layer_ids.push(layer20)
for(cntr=0;cntr<layer_ids.length;cntr++)
	{
	if(document.getElementById(layer_ids[cntr])) document.getElementById(layer_ids[cntr]).style.visibility = setting
	}
}


function show_contact_info()
{
if(document.getElementById("contact_info"))
	{
	if(partner != "")
		{
		hold_chr = "http://www.stashspace.com/sb_no_cache/chatstatus.js"
		}
	else
		{
		hold_chr = "/sb_no_cache/chatstatus.js"
		}
	loadjs(hold_chr)
	if(document.getElementById("contact_info").style.visibility == "visible")
		{
		show_contact = 0
		hide_contact_info()
		}
	else
		{
		show_contact = 1
		set_layer_vis('visible','contact_info')
		set_layer_vis('hidden','nav_menu_stash','nav_menu_share','nav_menu_overview','nav_menu_account','nav_menu_tapes','nav_menu_help_stash','nav_menu_help_share','menu_stash_help','faq_list','menu_stash_options','options')
		if(typeof(active_tab) != "undefined")
			{
			if(active_tab == "stash" || active_tab == "share")
				{
				var vis_layer = "nav_menu_contact_"+active_tab
				set_layer_vis('visible',vis_layer)
				}
			}
		}
	}
}

function refresh_chat()
{
if(show_contact == 1 && document.getElementById("live_chat_contact"))
	{
	if(chatactive && chatactive==1)
		{
		document.getElementById("live_chat_contact").style.visibility = "visible"
		}
	else
		{
		document.getElementById("live_chat_contact").style.visibility = "hidden"
		}
	}
if(show_contact == 0 && document.getElementById('alert_install'))
	{
	if(chatactive && chatactive==1)
		{
		document.getElementById("alert_live_chat").style.visibility = "visible"
		}
	else
		{
		document.getElementById("alert_live_chat").style.visibility = "hidden"
		}
	}
}

var chat_window = null

function goto_chat()
	{
	if(chatactive && chatactive == 1)
		{
		var options = ("dependent=no,status=no,menubar=no,scrollbars=no,resizable=yes,toolbar=no,height=340,width=472")
		var chat_url = ('http://server.iad.liveperson.net/hc/42621566/?cmd=file&file=visitorWantsToChat&site=42621566&imageUrl=http://server.iad.liveperson.net/hcp/Gallery/ChatButton-Gallery/English/General/1a/&referrer='+escape(document.location))
		
		//original old liveperson.net code
		//var options = ("dependent=no,status=no,menubar=no,scrollbars=no,resizable=yes,toolbar=no,height=320,width=472")
		//var chat_url = ('http://server.iad.liveperson.net/hc/42621566/?cmd=file&file=visitorWantsToChat&site=42621566&referrer='+escape(document.location))
		try
			{
			if(chat_window == null)
				{
				chat_window = window.open(chat_url,'chat42621566',options)
				}
			else if(chat_window.closed == false)
				{
				chat_window.focus()
				}
			else
				{
				chat_window = window.open(chat_url,'chat42621566',options)
				}
			}
		catch(err)
			{
			chat_window = window.open(chat_url,'chat42621566',options)
			}
		}
	}


function hide_contact_info()
{
set_layer_vis('hidden','contact_info','live_chat_contact','nav_menu_stash','nav_menu_share','nav_menu_overview','nav_menu_account','nav_menu_tapes','nav_menu_help_stash','nav_menu_help_share','menu_stash_help','faq_list','menu_stash_options','options','nav_menu_contact_stash','nav_menu_contact_share')
if(document.getElementById("account_pages") && document.getElementById("account_pages").style.visibility == "visible")
	{
	if(document.getElementById("account_frame") && String(document.getElementById("account_frame").src).indexOf("tape-drive"))
		{
		set_layer_vis('visible','nav_menu_tapes')
		}
	else
		{
		set_layer_vis('visible','nav_menu_account')
		}
	}
else if(typeof(active_tab) != "undefined")
	{
	var vis_layer = "nav_menu_"+active_tab
	set_layer_vis('visible',vis_layer)
	}
}



function do_tokes()
{
if(typeof(right_col_frame) != "undefined")
	{
	credit_qty = right_col_frame.document.getElementById('cust_credit').value
	cntr = right_col_frame.document.getElementById('cust_credit').selectedIndex
	}
else
	{	
	credit_qty = document.getElementById('cust_credit').value
	cntr = document.getElementById('cust_credit').selectedIndex
	}
hold_chr = ("STASH_CASH")
credit_price = credit_array_copy_price[hold_chr][cntr]
credit_item = hold_chr
}


function place_order()
{
if(typeof(right_col_frame) != "undefined")
	{
	if(right_col_frame.document.getElementById('cust_credit').selectedIndex == 0)
		{
		alert("Please use the drop-down list to select the number of credits\nyou would like to purchase before you click on \"buy.\"")
		return
		}
	}
else
	{
	if(document.getElementById('cust_credit').selectedIndex == 0)
		{
		alert("Please use the drop-down list to select the number of credits\nyou would like to purchase before you click on \"buy.\"")
		return
		}
	}
do_tokes()
if(!GetCookie("ref1"))
	{
	ref_code = ""
	}
else
	{
	ref_code = GetCookie("ref1")
	}
if(!GetCookie("tracker"))
	{
	track_code = ""
	}
else
	{
	track_code = GetCookie("tracker")
	}
	var price=0
var order_status=1
var hold_chr1 =""
cust_type="CONSUMER"
var empty_field=""
cntr = 1
page_code = "stash_credit"
cust_aff = ""
credit_description = credit_qty + " stashCash Tokens"
hold_chr = (''+code+'~'+pass+'~'+cust_type+'~'+page_code+'~'+cust_aff+'~'+cust_level+'~'+ref_code+'~'+track_code+'~')
hold_chr1 = ('item'+'~'+credit_item+'~'+credit_description+'~'+credit_price+'~'+credit_qty+'~'+'~'+'~')
hold_chr = (hold_chr + hold_chr1)
var options = ("dependent=no,height=750,width=480,location=0,directories=0,menubar=0,left=1,top=1,resizable=0,scrollbars=1,status=1,toolbar=0")
if((document.location.host).indexOf("thinkpad") > -1 || document.location.host=="dev.stashspace.com" || document.location.host=="qa.stashspace.com")
	{
	hold_chr1 = ("/secure/master_order_main.htm?"+hold_chr)
	}
else
	{
	hold_chr1 = ("https://www.stashspace.com/secure/master_order_main.htm?"+hold_chr)
	}
orderWin = window.open(hold_chr1,"popped",options)
if(typeof(right_col_frame) != "undefined")
	{
	right_col_frame.document.getElementById('cust_credit').selectedIndex = 0
	}
else
	{
	document.getElementById('cust_credit').selectedIndex = 0
	}
order_cntr = 0
order_time = window.setInterval("order_refresh()",5000)
}



//My Account Stuff//


function show_login_alert()
	{
	if(document.getElementById("loginbox") && document.getElementById("login_alert"))
		{
//jal 12/01/07		document.getElementById("loginbox").style.top = "213px"
//jal 12/01/07		document.getElementById("loginbox").style.left = "125px"
//jal 12/01/07		document.getElementById("close_but").src = "/images/spacer-trans.gif"
//jal 12/01/07		document.getElementById("close_but").style.cursor = "auto"
//jal 12/01/07		document.getElementById("login_alert").style.visibility = "visible"
		hold_chr = ("url('/images/index_bubble_login_long.gif')")	
		document.getElementById("loginbox").style.backgroundImage = hold_chr

		show_login()
		}
	else
		{
		alert("You are trying to access a members-only area.  Please login or sign-up for an account")
		}
	}


function hide_login_alert()
	{
	document.getElementById("login_alert").style.visibility = "hidden"
//jal	document.getElementById("close_but").src="/images/login_close.gif"
//jal	document.getElementById("close_but").style.cursor = "pointer"
	hide_login()
	document.getElementById("loginbox").style.top = "35px"
	document.getElementById("loginbox").style.left = "464px"
	}


function pop_signup()
	{
	if(GetCookie("homemovie"))
		{
		alert("You're already logged in with an account.")
//		document.location = "/my-account/index.stm"
		return
		}
	else
		{
//		conf_code = prompt("StashSpace is currently in Private Beta through September 5. \nIf you received an invitation code, please enter it below.","")
//		if(conf_code)
//			{
//			conf_code = conf_code.toLowerCase()
//			}
//	
//		if(conf_code == "chewuch")
//			{	
			document.location = "/sign-up.stm"
//			}
//		else
//			{
//			return
//			}
		}
	}


function pop_whyphone()
	{
	var options = ("dependent=no,height=300,width=700,location=0,directories=0,menubar=0,resizable=0,left=100,top=300,scrollbars=0,status=0,statusbar=0,toolbar=0")
	whyphoneWin = window.open("/support/whyphone.stm","whyphone",options)
	whyphoneWin.focus()
	return	
	}

function pop_mobile()
	{
	var options = ("dependent=no,height=200,width=700,location=0,directories=0,menubar=0,resizable=0,left=100,top=300,scrollbars=0,status=0,statusbar=0,toolbar=0")
	mobileWin = window.open("/support/mobile-video.stm","mobile",options)
	mobileWin.focus()
	return	
	}

function pop_policy()
	{
	var pos_left = screen.availWidth - 645
	var options = ("dependent=no,height="+screen.availHeight+",width=645,location=0,directories=0,menubar=0,resizable=0,left="+pos_left+",top=0,scrollbars=1,statusbar=0,toolbar=0")
	policyWin = window.open("/privacy-policy.stm","policy",options)
	policyWin.focus()
	return	
	}


function launch_blog()
	{
	var options = ("dependent=no,height=750,width=750,location=0,directories=0,menubar=0,resizable=1,left=20,top=20,scrollbars=1,statusbar=0,toolbar=0,titlebar=1,menubar=0")
	player = window.open("http://lugnut22.typepad.com/stashspace/","blog",options)
	player.focus()	
	}

function launch(what_page)
	{
	var options = ("dependent=no,height=780,width=690,location=0,directories=0,menubar=0,resizable=1,left=20,top=20,scrollbars=1,statusbar=0,toolbar=0,titlebar=1,menubar=0")
	player = window.open("http://www.stashspace.com/" + what_page + ".stm",what_page,options)
	player.focus()
	}


function swap_image(id,state, name)
{
if(!name)name = id
var folder=""
try
	{
	var current_pathname = String(document.location.pathname)
	if(current_pathname.indexOf("partners") > -1 && current_pathname.indexOf("demo") < 0)
		{
		folder = "/partners"
		}
	else
		{
		folder = partner_folder
		}
	document.getElementById(id).src = folder + ("/images/" + name + "-" + state + ".gif")
	}
catch(err)
	{
	return
	}
}


function swap_share(id,state)
{
if(last_active == id)
	{
	}
else
	{
	document.getElementById(id).src = ("afinitihome3/images/home/" + id + "_" + state + ".gif")
	}
}

function click_share(id,state)
{
if(last_active == id)
	{
	}
else
	{
	document.getElementById(id).src = ("afinitihome3/images/home/" + id + "_" + state + ".gif")
	if(last_active=="")
		{
		}
	else
		{
		document.getElementById(last_active).src = ("afinitihome3/images/home/" + last_active + "_" + "off" + ".gif")
		}
	last_active = id
	}
}


function loadoel()
{
var player = window.open("http://www.operationenduringlove.com")
}


function load_statement()
{
var options = ("height=600,width=575,location=0,directories=0,menubar=0,resizable=1,left=0,top=0,scrollbars=0,status=0,toolbar=0")
hold_chr = ("../cust_statement.htm?" + code)
window.open(hold_chr,"ActivityStatement",options) 
}


function load_beta(version)
{
needs_install = 0
var no_launch = 0
random_location()  // sets stash_url in stash_domains.js

var wmp_ver_1 = new String(WMPVer)
var wmp_ver_2 = wmp_ver_1.indexOf(".")
var wmp_version = wmp_ver_1.substr(0,wmp_ver_2)
if(wmp_version == 11)
	{
	alert("You have Windows Media Player version 11 installed. Please be forewarned that there\nare some limitations in using stashBox with this version. Setting scene start and end\npoints is more difficult, and encoding from camcorder is not recommended due to high\nCPU utilization and how that can affect the quality of your movie.")
	}

hold_chr = document.location + ""
if (version == "40" || version == "30" || version == "1.0" || version == "4.0")
	{
	if(hold_chr.indexOf("dev.stashspace.com") > -1)
		{
		stash_url = "http://sp1.stashspace.com/afiniti40/afiniti_index.htm?"
		}
	else
		{
		stash_url = stash_url + "afiniti40/afiniti_index.htm?"
		}
	}
else if (version == "42" || version == "2.0" || version == "4.2")
	{
	stash_url = stash_url + "afiniti42/afiniti_index.htm?"
	}
else if (version == "choice")
	{
	if(hold_chr.indexOf("dev.stashspace.com") > -1)
		{
		stash_url = "http://dev.stashspace.com/my-account/stashbox-intro.stm?"
		}
	else
		{
		stash_url = "http://www.stashspace.com/my-account/stashbox-intro.stm?"
		}
	}

if(js_exists != 1)
	{
	if ((document.location.pathname).indexOf("/player.stm") > -1)
		{
		type="s1"
		sb_code = share_id
		}
	else
		{
		alert('You must log in first in order to complete this operation.')
		return
		}
	}
else if(cust_aff == "stashspace")
	{
	type="l1"
	cust_share = GetCookie('vs_guest')
	afiniti_name = share_fname
	if(stash_url.indexOf("afiniti42") > -1)
		{
		sb_code = ""
		}
	else
		{
		sb_code = code + "~" + pass
		}
	if(activation_key.length == 0)
		{
		var active_browser = ""
		var active_ver = ""
		var needs_install = 0
		
		if(browser_platform=="PC")
			{
			if(browser_type.search("Explorer")!=-1)
				{
				active_browser="ie"
				hold_chr = browser_version.indexOf("MSIE") + 5
				hold_chr = browser_version.substr(hold_chr,browser_version.length)
				active_ver = hold_chr.indexOf(".")
				active_ver = hold_chr.substr(0,active_ver)		
				if(active_ver > 5)
					{
/* jl_11_23					needs_install = 1
					if(confirm('You must install stashBox before you can open it.  Installation is free.\nIn fact, you\'ll earn 15 FREE stashTokes for installing.\n\nClick "OK" to install now or "Cancel" to return.'))
						{
						document.location = "/my-account/installing-tools.stm"
						return
						}
					else
						{
						return
						} */
					}
				}
			}
		}
	}
else
	{
	type="l1"
	cust_share = GetCookie('vs_guest')
	afiniti_name = share_fname
	if(stash_url.indexOf("afiniti42") > -1)
		{
		sb_code = ""
		}
	else
		{
		sb_code = code + "~" + pass
		}
	}

//alert("ax_ver = " + ax_ver + "\nsb_ver = " + version + "\nallow = " + allow)
	
if(needs_install == 0 && allow == 1)
	{
	var options = ("dependent=no,height=770,width=755,location=0,directories=0,menubar=0,resizable=0,left=20,top=20,scrollbars=0,statusbar=0,toolbar=0,titlebar=0,menubar=0")
	if(player == null)
		{
		player = window.open(stash_url + type + "~" + sb_code,"player_" + code,options)
		player.focus()
		}
	else if(player.closed == false)
		{
		player.focus()
		}
	else
		{
		player = window.open(stash_url + type + "~" + sb_code,"player_" + code,options)
		player.focus()
		}
	}
else
	{
	alert("You cannot open stashBox until your computer is checked\nfor compatibility on the \"My Account\" page.")
	return
	}
}

function load_beta_old(version)
{
is_beta = 1
if(!code)
	{
	window.location="cons_myafiniti_login.htm"	
	}
else
	{
	if(!player || !player.upper.cntr)
		{
		var options = ("dependent=no,height=688,width=880,location=0,directories=0,menubar=0,resizable=0,left=20,top=20,scrollbars=0,statusbar=0,toolbar=0,titlebar=0,menubar=0")
		if (version=="23")
			{
			player = window.open("../afiniti23/afiniti_index.htm","player",options)
			player.focus()
			}
		if (version=="30")
			{
			var options = ("dependent=no,height=688,width=880,location=0,directories=0,menubar=0,resizable=0,left=20,top=20,scrollbars=0,statusbar=0,toolbar=0,titlebar=0,menubar=0")
			player = window.open("../afiniti30/afiniti_index.htm","player_" + code,options)
			player.focus()
			}
//			player = window.open("http://www.homemovie.com/afiniti30/afiniti_index.htm","player",options)
//			player.focus()
		}
	else
		{
		player.focus()
		}	
	}
}

function focus_it(field)
{
	document.getElementById(field).style.backgroundColor = "#FFFFFF"
}

function blur_it(field)
{
	document.getElementById(field).style.backgroundColor = "#EFEFEF"
}

function el()
{
}


function parse_chrs(field)
{
var test_string = new String()
test_string = ("" + field)
var replacer1 = new RegExp('~','g')
var replacer2 = new RegExp(',','g')
var replacer3 = new RegExp("'","g")
var replacer4 = new RegExp('"','g')
var replacer5 = new RegExp('"',"g")
var replacer6 = /\r/g
var replacer7 = /\n/g
var replacer8 = new RegExp('#','g')
if(test_string && test_string !="")
	{
	test_string = test_string.replace(replacer1,"`")
	test_string = test_string.replace(replacer2,"`")
	test_string = test_string.replace(replacer3,"~")
	test_string = test_string.replace(replacer4,"~")		
	test_string = test_string.replace(replacer5," ")	// don't allow any pipes
	test_string = test_string.replace(replacer6,"|")	// change new lines to pipes
	test_string = test_string.replace(replacer7,"|")	// change cr to pipes
	test_string = test_string.replace(replacer8,"``")
	return(test_string)
	}
else
	{
	return(field)
	}	
}

function unparse_chrs(field)
{	
var test_string = new String()
test_string = ("" + field)
var replacer1 = new RegExp('``',"g")
var replacer2 = new RegExp('`',"g")
if(test_string && test_string !="")
	{
	test_string = test_string.replace(replacer1,"#")
	test_string = test_string.replace(replacer2,"~")
	return(test_string)
	}
else
	{
	return(field)
	}	
}


function goto_myaccount(what_cookie,what_loc,what_func)
{
if(!GetCookie(what_cookie))
	{
	if(what_cookie == "homemovie")
		{
		if(what_loc.indexOf("my-stash") > -1)
			{
			if(GetCookie("demo"))
				{
				document.location = (document.location.protocol + "//" + document.location.host + what_loc)
				}
			else
				{
//				show_login_alert()
				show_login(1)				
				}
			}
		else if(what_loc.indexOf("my-shares") > -1)
			{
			if(String(document.location.search).indexOf('?f~') > -1 || String(document.location.search).indexOf('?share~') > -1)
				{
				document.location = (document.location.protocol + "//" + document.location.host + "/my-stash/index.stm") + String(document.location.search)
				}
			else if(GetCookie('vs_guest'))
				{
				document.location = (document.location.protocol + "//" + document.location.host + "/my-stash/index.stm")
				}
			else
				{
//				show_login_alert()
				show_login(1)								
				}
			}
		else
			{
//			show_login_alert()
			show_login(1)				
			}
		}
	}
else
	{
	if(what_func)
		{
		eval(what_func)
		}
	else
		{
		document.location = (document.location.protocol + "//" + document.location.host + what_loc)
		}
	}
}

function load_afiniti(mode)
{
if (mode == "video")
	{
	hold_chr = "Upload Videos"
	}
else if (mode == "photo")
	{
	hold_chr = "Upload Photos"
	}
else if (mode == "dvd")
	{
	hold_chr = "Buy DVDs"
	}
else if (mode == "movie")
	{
	hold_chr = "Share Your Movies"
	}

//alert("You have chosen to launch Afiniti 3.0 beta to " + hold_chr + ".  Please hold your horses")
}


function move_box(gloss, box) {
  var pos_left = 0;
  var pos_top = 0;
  var obj = gloss;
  while (obj.offsetParent) {
    pos_left += obj.offsetLeft;
    pos_top += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = pos_left + 'px';
  pos_top += gloss.offsetHeight + 4;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    pos_top += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = pos_top + 'px';
}

function show_hide_box(gloss, height, width, borderStyle) {
  var href = gloss.href;
  var boxdiv = document.getElementById(href);

  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(gloss, boxdiv);
      boxdiv.style.display='block';
    } else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', href);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  boxdiv.style.backgroundColor = '#444444';

  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;

  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(gloss, boxdiv);

  return false;
}

