var page_code=""
var my_time=0
var cust_exists=1
var current_date = new Date()
var order_status=1
var order_win=null
// var order_date=""
// var current_month = (current_date.getMonth()+1)
// var current_day = current_date.getDate()
// var current_year = current_date.getFullYear()
// if (current_month < 10)
// 	{
// 	current_month = "0" + current_month
// 	}
// if (current_day < 10)
// 	{
// 	current_day = "0" + current_day
// 	}
// current_year = "" + current_year
// order_date = current_year + current_month + current_day
var movie_cntr=1
var my_time_checker=0
var tape_fee = 0
var calc_done=0
var field=""

share_fields = ((document.location.search).replace("?","")).split("~")

if(GetCookie("homemovie"))
	{
	parse_cookie()
	hold_chr = cust_script_path + code + ".js"
	loadjs(hold_chr)
	}
else if(GetCookie("demo"))
	{
    hold_chr = new String(GetCookie("demo"))
	if(hold_chr.length > 0)
		{
		var string_sort = hold_chr.split('~')
		code = string_sort[1]
		enc_pass = string_sort[2]
		pass = enc_pass.slice(2,enc_pass.length-2).substring(0,2) + enc_pass.slice(2,enc_pass.length-2).substring(4,enc_pass.slice(2,enc_pass.length-2).length)
		cust_type = string_sort[3]
		hold_chr = cust_script_path + code + ".js"
		loadjs(hold_chr)
		}
	}
else if(share_fields[0] == "f")
	{
	if((document.location.pathname).indexOf("my-stash") > -1)
		{
		share_code = (document.location.search).toString()
		feed_loading = 1
		switch_page("shares")
		}
	}
else
	{
	if(share_fields[0] == "share")
		{
		share_code = share_fields[1]
		}
	else if(GetCookie("vs_guest"))
		{
		share_code = GetCookie("vs_guest")
		}
	else
		{
		alert("You must be logged in to retrieve your account information.  Please login\nfrom the home page and you can return here.")
		window.location = partner_folder + "/index.stm"
		}
	if((document.location.pathname).indexOf("my-stash") > -1 && share_code != "")
		{
		share_loading = 1
		hold_chr = tape_script_path + "share_scripts/Afiniti%203/" + share_code + ".js"
		loadjs(hold_chr)
		check_time = window.setInterval("check_share_code()",500)
		}
	}


/////////////////////////////////////////////////////////////////////////////////////
// The next two functions are for stashBox use only.  Do not change! *sbh 4/9/07*  //
/////////////////////////////////////////////////////////////////////////////////////
function tkTotal(num)
{
/*
if(num == "" || num == "0")
	{
	num = "no"
	}
if(document.getElementById("stash_cash"))
	{
	document.getElementById("stash_cash").value = "You have " + num + " stashTokes"
	}
if(document.getElementById("right_col_frame"))
	{
	right_col_frame.document.getElementById("box_stash_cash").value = "You have " + num + " stashTokes"
	}
*/
}

function reload_stats_for_sb()
{
// hold_chr = tape_script_path + "cash/" + code + "_cash.js"
// loadjs(hold_chr)
hold_chr = tape_script_path + code + "_tots.js"
loadjs(hold_chr)
}
/////////////////////////////////////////////////////////////////////////////////////
// The above two functions are for stashBox use only.  Do not change! *sbh 4/9/07* //
/////////////////////////////////////////////////////////////////////////////////////


var my_time = 120
var cust_exists = 1
var name = ""


function bad_login()
{
}

function cust_login1()
{
	// window.clearTimeout(my_time)
	cust_login2()
}

var post_reload_cust_script = ""
function cust_login2()
{
if(post_reload_cust_script!= "")
	{
	var temp = post_reload_cust_script
	post_reload_cust_script = ""
	eval(temp)
	return
	}

if (js_exists == 1)
	{
	if(stash_cash_tot == "" || stash_cash_tot == "0")
		{
		stash_cash_tot = "no"
		}
	if(document.getElementById("stash_cash"))
		{
		document.getElementById("stash_cash").value = "You have " + stash_cash_tot + " stashTokes"
//		var found_cust = new String(document.form1.cust_coname.value)
//		var last_chr = found_cust.length - 1
//		if(found_cust.charAt(last_chr) != ".")
//			{
//			document.getElementById('user').value = "Welcome to stashSpace,\n" + document.form1.cust_coname.value + "."
//			}
//		else
//			{
//			document.getElementById('user').value = "Welcome to stashSpace,\n" + document.form1.cust_coname.value
//			}
		}	
//ltk 10/9 address info area.
//		hold_chr = new String(document.getElementById('cust_phone').value)
//		hold_chr1 = hold_chr.substr(0,3) + "-" + hold_chr.substr(3,3) + "-" + hold_chr.substr(6,4)
//		document.getElementById('acctn').value = hold_chr1

//		hold_chr = new String(document.getElementById('cust_name').value)
//		hold_chr1 = hold_chr + "\r"

//		if (document.getElementById('cust_city').value != "")
//			{
//			hold_chr = new String(document.getElementById('cust_add').value)
//			hold_chr1 = hold_chr1 + hold_chr + "\r"
//			cntr = cntr + 1

//			hold_chr = document.getElementById('cust_city').value
//			hold_chr = hold_chr + ", " + document.getElementById('cust_state').value
//			hold_chr = hold_chr + "  " + document.getElementById('cust_zip').value
//			hold_chr1 = hold_chr1 + hold_chr + "\r"

//			document.getElementById('cust_info').rows = 4
//			document.getElementById('cust_info').style.overflow = "auto"
//			}

//		hold_chr = new String(document.getElementById('cust_email').value)
//		hold_chr1 = hold_chr1 + hold_chr

//		document.getElementById('cust_info').value = hold_chr1

//		show_cust_layer()
	load_next()
	}
}


function start_install()
	{
	document.location = "installing-tools.stm"
	}


//ltk
//var cc_code = ("http://www.homemovie.com/custs/cc/" + code + ".js")
//loadjs(cc_code)

function return_tapes()
{
var ref1 = ""
var tracker = ""

if(GetCookie("ref1"))
	{
	ref1 = GetCookie("ref1")
	}
else
	{
	ref1 = "af_return"
	}

if(GetCookie("tracker"))
	{
	tracker = GetCookie("tracker")
	}
else
	{
	tracker = "0"
	}

page_code = "stash_return"

//	alert("Thank you for your request.  Your tapes will be returned to you \nvia the shipping method that you specify on the order page.")
hold_chr = (''+code+'~'+pass+'~'+cust_type+'~'+page_code+'~'+cust_aff+'~'+'~'+ref1+'~'+tracker+'~')
hold_chr = hold_chr + ('item'+'~'+'RETURN_TAPES'+'~'+'Return My Processed Tapes'+'~'+'0'+'~'+'1'+'~'+'~'+'~')

var options = ("dependent=no,height=760,width=480,location=0,directories=0,menubar=0,left=10,top=0,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_chr2 = ("/secure/master_order_main.htm?"+hold_chr)
	}
else
	{
	hold_chr2 = ("https://www.stashspace.com/secure/master_order_main.htm?"+hold_chr)
	}
if(order_win == null)
	{
	order_win = window.open(hold_chr2,"popped",options)
	}
else if(order_win.closed == false)
	{
	order_win.focus()
	}
else
	{
	order_win = window.open(hold_chr2,"popped",options)
	}
}



function arcsoft()
{
var ref1 = ""
var tracker = ""

if(GetCookie("ref1"))
	{
	ref1 = GetCookie("ref1")
	}
else
	{
	ref1 = "af_return"
	}

if(GetCookie("tracker"))
	{
	tracker = GetCookie("tracker")
	}
else
	{
	tracker = "0"
	}

page_code = "arcsoft"

//	alert("Thank you for your request.  Your tapes will be returned to you \nvia the shipping method that you specify on the order page.")
hold_chr = (''+code+'~'+pass+'~'+cust_type+'~'+page_code+'~'+cust_aff+'~'+'~'+ref1+'~'+tracker+'~')
hold_chr = hold_chr + ('item'+'~'+'ARCSOFT'+'~'+'Arcsoft ShowBiz DVD 2'+'~'+'0'+'~'+'1'+'~'+'~'+'~')

var options = ("dependent=no,height=760,width=480,location=0,directories=0,menubar=0,left=10,top=0,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_chr2 = ("/secure/master_order_main.htm?"+hold_chr)
	}
else
	{
	hold_chr2 = ("https://www.stashspace.com/secure/master_order_main.htm?"+hold_chr)
	}
if(order_win == null)
	{
	order_win = window.open(hold_chr2,"popped",options)
	}
else if(order_win.closed == false)
	{
	order_win.focus()
	}
else
	{
	order_win = window.open(hold_chr2,"popped",options)
	}
}


function load_cc()
{
hold_chr = ""
cntr1 = 1
for(cntr=1;cntr<5;++cntr)
	{
	if(document.getElementById('cc_num'+cntr).value !="" && document.getElementById('cc_num'+cntr).value !="~")
		{
		document.getElementById('cc_track'+cntr).value = cntr
		document.getElementById('cc'+cntr).value = ((document.getElementById('cc_type'+cntr).value) + " - #" + (document.getElementById('cc_num'+cntr).value) + " - Exp. " + (document.getElementById('cc_month'+cntr).value) + "/" + (document.getElementById('cc_year'+cntr).value))
		if (cntr == 1 )
			{
			hold_chr = document.getElementById("cc"+cntr).value + "\r"
			}
		else
			{
			hold_chr = hold_chr + document.getElementById("cc"+cntr).value + "\r"
			cntr1 = cntr1 + 1
			}
		}
	else
		{
		document.form1.elements["cc"+cntr].value = ("")
		}
	}
hold_chr1 = hold_chr.lastIndexOf('\r')
hold_chr = hold_chr.substr(0,hold_chr1)
document.getElementById('cc_all').rows = cntr1
document.getElementById('cc_all').style.overflow = "auto"
document.getElementById('cc_all').value = hold_chr
}


function order_refresh()
{
order_cntr++
if (typeof(orderWin) != "undefined" || orderWin != null)
	{	
	if (orderWin.closed)
		{
		window.clearInterval(order_time)
		orderWin = null
		reload_stats_for_sb()
		}
	}
else if(order_cntr == 60)
	{
	window.clearInterval(order_time)
	}
}


//show_cust_layer()

var progress_step = ""
var progress_num = 0
var progress_cntr = 0
var time_int = 0
function progress_bar(time)
	{
	time_int = time
	progress_cntr++
	if(progress_cntr==51)
		{
		if(document.location.search == "?ic")
			{
			document.location = "index.stm"
			}
		else if(document.location.search == "?spec")
			{
			document.location = "/special-offer/index.stm"
			}
		else if(document.location.search == "?i")
			{
			// redirect to install or stashBox Exe (if already installed)
			document.getElementById("signup_install").style.visibility = "hidden"
			document.getElementById("progress_bar_display").style.visibility = "hidden"
			document.location = "/my-account/index.stm?welcome"
			}
		/*else if(document.location.search == "?i")
			{
			// redirect to install or stashBox Exe (if already installed)
			document.getElementById("signup_install").style.visibility = "hidden"
			document.getElementById("progress_bar_display").style.visibility = "hidden"
			player_frame.local_sb()
			}
		*/
		else
			{
			document.getElementById("activex_check").style.visibility = "hidden"
			document.getElementById("progress_bar_display").style.visibility = "hidden"
			}	
		return
		}
	progress_step = "progress_step" + progress_cntr
	progress_num = progress_cntr * 2
	document.getElementById(progress_step).style.backgroundColor = "#AAAAAA"
	document.getElementById("progress_pct").value = progress_num
	setTimeout("progress_bar(time_int)", time_int)
	}

if(document.location.search == "?ic")
	{
	if(document.getElementById("install_confirm"))
		{
		document.getElementById("install_confirm").style.visibility = "visible"
		document.getElementById("progress_bar_display").style.visibility = "visible"
		progress_bar(500)
		}
	}
if(document.location.search == "?spec")
	{
	if(document.getElementById("signup_confirm"))
		{
		document.getElementById("signup_confirm").style.visibility = "visible"
		document.getElementById("progress_bar_display").style.visibility = "visible"
		progress_bar(500)
		}
	}
else if(document.location.search == "?i")
	{
	if(document.getElementById("signup_install"))
		{
		document.getElementById("signup_install").style.visibility = "visible"
		document.getElementById("progress_bar_display").style.visibility = "visible"
		progress_bar(500)
		}
	}

else if(document.location.search == "?exe")
	{
	var exe_wait = window.setTimeout("player_frame.local_sb()",3000)
	}




