// Shopping Cart System Script.
// Copyright JomiTech 2004. All Rights Reserved.
var Items = new Array();

// ---------- Add items here ------------
// Eg: addItem( "Description", "ItemID", "Price" )
// Please do not add the dollar sign '$' into the price.
addItem("Raising Newborns From Birth To Weaning - Saving LIVES!", "A2", "10", "D" );
addItem("Lookin Good", "A1", "7", "D" );
addItem("Good Breeding", "A3", "7.00", "D" );
addItem("How to Have Purr-fect Faith, even at a cat show.", "EB1", "5.00", "D" );
addItem("How to Have Perfect Faith, even at a cat show", "B1", "12.95", "S" );
addItem("The Purr-fect Bath for Persians and other Longhairs DVD", "DVD1", "19.95", "S" );
addItem("The Sampler : 10 Life Enhancing-Concepts Right at Your Fingertips", "B2", "9.99", "S" );
addItem("Welcoming Home Your New Kitten", "A4", "3", "D" );
addItem("Adopting a Persian Kitten", "A5", "5", "D" );
addItem("Alone In The Light", "B4", "11.95", "S" );
addItem("The Sampler : 10 Life Enhancing-Concepts Right at Your Fingertips- CD", "BCD2", "14.99", "S" );
addItem("The Sampler : 10 Life Enhancing-Concepts Right at Your Fingertips- Gift Set", "BGS2", "19.99", "S" );
addItem("How the Lilies Grow", "B5", "13.95", "S" );
addItem("Good Breeding and Purr-fect Faith", "A3EB1SP", "12.00", "D" );
addItem("Adopting a Persian Kitten and Purr-fect Faith", "A5EB1SP", "12.00", "D" );
addItem("The Purr-fect Bath, Hollywood for Persians and other Longhairs DVD", "DVDH", "24.95", "S" );
addItem("Rindside Edition- preorder-The Purr-fect Bath for Persians and other Longhairs DVD", "DVDR", "19.95", "S" );
addItem("DVD Combo Sale", "DVD12", "40.00", "S" );
addItem("DVD Combo and Purrfect Faith E-book", "SP1", "45.00", "S" );
addItem("The Gift of Loss", "B3", "13.95", "S" );
addItem("12 oz Prayer Bath Salt", "12prayer", "19.95", "S" );
addItem("12 oz Prayer Mositure Bath Salt", "12mprayer", "22.95", "S" );
addItem("12 oz Prayer Tub Gift Set Bath Salt", "12tubprayer", "29.95", "S" );
addItem("6 oz Prayer Tub Bath Salt", "6tubprayer", "17.95", "S" );
addItem("Small Tub", "smalltub", "9.95", "S" );
// ---------- End of items list ------------

document.write("<form name=\"abscart\" action=\"http://ww9.aitsafe.com/cf/add.cfm\" method=\"post\" target=\"abscart\">");
document.write("<input type=\"hidden\" name=\"userid\" value=\"B398945\">");
document.write("<input type=\"hidden\" name=\"product\" value=\"nothing\">");
document.write("<input type=\"hidden\" name=\"price\" value=\"0\">");
document.write("<input type=\"hidden\" name=\"units\" value=\"0\">");
document.write("</form>");

function Item( Description, ID, Cost, Type )
{
	this.Desc = Description;
	this.ID = ID;
	this.Cost = Cost;
	this.Type = Type;
}

function addItem( Description, ID, Cost, Type )
{
	var ActualCost;
	
	if( Description == "" )
	{
		document.write( "Description is empty on line 'addItem(\"" + Description + "\", \"" + ID + "\", \"" + Cost + "\", \"" + Type + "\");'<br>" );
		return;		
	}
	
	if( ID == "" )
	{
		document.write( "ID is empty on line 'addItem(\"" + Description + "\", \"" + ID + "\", \"" + Cost + "\, \"" + Type + "\");'<br>" );
		return;		
	}
	
	ActualCost = parseFloat( Cost );
	if( ActualCost <= 0 || ActualCost == NaN )
	{
		document.write( "Cost is invalid on line 'addItem(\"" + Description + "\", \"" + ID + "\", \"" + Cost + "\", \"" + Type + "\");'<br>" );
		return;		
	}
	
	if( Type != "S" && Type != "D" )
	{
		document.write( "Type is invalid on line 'addItem(\"" + Description + "\", \"" + ID + "\", \"" + Cost + "\", \"" + Type + "\");'<br>" );
		return;		
	}
	
	Items.push( new Item( Description, ID, Cost, Type ) );
}

function addToCart( ID )
{
	var w, screenWidth, screenHeight, Index;
	
	screenWidth = screen.availWidth - 200;
	screenHeight = screen.availHeight - 200;
	
	Index = findItem( ID );
	if( Index < 0 )
	{
		alert( "Can't find item " + ID + ". Please contact the web site administrator to resolve this problem." );
		return;
	}
	
	w = window.open( "", "abscart", "width=" + screenWidth + ",height=" + screenHeight + ",toolbar=0,scrollbars=1,statusbar=1,menubar=0,left=0,top=0,resizable=0,screenX=0,screenY=0" );
	document.abscart.product.value = Items[ Index ].Desc;
	document.abscart.price.value = Items[ Index ].Cost;
	
	if( Items[ Index ].Type == "S" )
		document.abscart.units.value = Items[ Index ].Cost;
	else
		document.abscart.units.value = "0";
		
	document.abscart.submit();
	w.focus();	
}

function findItem( ID )
{
	var i;
	
	for( i = 0; i < Items.length; ++i )
	{
		if( Items[i].ID == ID )
			break;
	}
	
	if( i == Items.length )
		i = -1;
	
	return i;
}

function viewCart()
{
	var w, screenWidth, screenHeight;
	
	screenWidth = screen.availWidth - 200;
	screenHeight = screen.availHeight - 200;
	
	w = window.open( "http://ww9.aitsafe.com/cf/review.cfm?userid=B398945", "abscart", "width=" + screenWidth + ",height=" + screenHeight + ",toolbar=0,scrollbars=1,statusbar=1,menubar=0,left=0,top=0,resizable=0,screenX=0,screenY=0" );
	w.focus();
}