function go(url, windowname3) {
opener.location.href = url;
window.close(windowname3);
} 

function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
        while (cbegin < clen) {
        var vbegin = cbegin + cname.length;
                if (dcookie.substring(cbegin, vbegin) == cname) { 
                var vend = dcookie.indexOf (";", vbegin);
                        if (vend == -1) vend = clen;
                return unescape(dcookie.substring(vbegin, vend));
                }
        cbegin = dcookie.indexOf(" ", cbegin) + 1;
                if (cbegin == 0) break;
        }
return null;
}

function setCookie (name, value, expires) {
        if (!expires) expires = new Date();
document.cookie = name + "=" + escape (value) + 
"; expires=" + expires.toGMTString() +  "; path=/";
}



function delCookieArray () {


	   expireDate = new Date;
	   expireDate.setDate(expireDate.getDate()-1);

	var deleteArray = new getCookieArray("artopiumcart");

	l = deleteArray.length;

	  for (i=0; i<l; i++) {
			fullname = "artopiumcart" + i;
    	   document.cookie = fullname + "=;expires=" + expireDate.toGMTString();
	   }

}



function setCookieArray(name){
this.length = setCookieArray.arguments.length - 1;
        for (var i = 0; i < this.length; i++) {
        this[i + 1] = setCookieArray.arguments[i + 1]
        setCookie (name + i, this[i + 1], expdate);
        }        
}


function getCookieArray(name){
var i = 0;
        while (getCookie(name + i) != null) {
        this[i + 1] = getCookie(name + i);
        i++; this.length = i; 
        }
}



var expdate = new Date();
expdate.setTime (expdate.getTime() +  (24 * 60 * 60 * 1000 * 365));


function deletethiscookie (itemtodelete) {
	
		var deleteArray = new getCookieArray("artopiumcart");
		delCookieArray();
		e = deleteArray.length;
		for(j=1; j<=e; j++) {
			if (deleteArray[j] != itemtodelete) {
				addtocookie(deleteArray[j]);
			}
		}
}

function addtocookie (itemtoadd) {

var testArray = new getCookieArray("artopiumcart");
r = testArray.length;
if (r>0) {
	code = 'var addIt = new setCookieArray("artopiumcart"';
	for (p=1; p<=r; p++) {
		code += ', "' + testArray[p] + '"';
	}
	code += ', "' + itemtoadd + '"';
	code += ');';
	eval(code);
}
else {
	var addIt = new setCookieArray("artopiumcart", itemtoadd);
}


}


function seecart () {

var viewIt = new getCookieArray("artopiumcart");
l = viewIt.length;

var stuff = 'products=';
if (l>0) {
	for (u=l; u>0; u--) {
		stuff += viewIt[u] + ',';
	}

}

gourl = 'http://artopium.virtualave.net/space/see_cart.cgi?';
gohere = gourl + stuff;
location.href = gohere;


}






/****** this object holds all of the key data **********/
function Link(name, url)
{
	this.name = name;
	this.title = new Array();
	this.url = new Array();
}
/**************************************************************/
var names      = new Array ();
var temp       = new Array ();
var temp2 		= new Array ();
var link       = new Link ();
var final_list = new Array ();
/******** array declaration... it holds all of the data for the menus ****/
var menu = new Array (
"All Artwork,*All Categories|All Categories",
"Music*All|All#" +
	"2-step|2-step#" +
	"A`cappella|A`cappella#" +
	"Acoustic|Acoustic#" +
	"Afro-beat|Afro-beat#" +
	"Alternative|Alternative#" +
	"Ambient|Ambient#" +
	"Big Beat|Big Beat#" +
	"Black Metal|Black Metal#" +
	"Bluegrass|Bluegrass#" +
	"Blues|Blues#" +
	"Breakbeat|Breakbeat#" +
	"Christian|Christian#" +
	"Christian Rap|Christian Rap#" +
	"Classic Rock|Classic Rock#" +
	"Classical|Classical#" +
	"Club|Club#" +
	"Country|Country#" +
	"Death Metal|Death Metal#" +
	"Disco House|Disco House#" +
	"Down-tempo|Down-tempo#" +
	"Drum and Bass|Drum and Bass#" +
	"Dub|Dub#" +
	"Electro|Electro#" +
	"Electronica|Electronica#" +
	"Emo|Emo#" +
	"Experimental|Experimental#" +
	"Folk|Folk#" +
	"Folk Rock|Folk Rock#" +
	"Funk|Funk#" +
	"Garage|Garage#" +
	"Glam|Glam#" +
	"Gothic|Gothic#" +
	"Grindcore|Grindcore#" +
	"Grunge|Grunge#" +
	"Hard House|Hard House#" +
	"Hardcore|Hardcore#" +
	"Hip-Hop|Hip-Hop#" +
	"House|House#" +
	"Independent|Independent#" +
	"Industrial|Industrial#" + 
	"Jam Band|Jam Band#" +
	"Jazz|Jazz#" +
	"Jungle|Jungle#" +
	"Latin|Latin#" +
	"Lounge|Lounge#" +
	"Metal|Metal#" +
	"New Wave|New Wave#" +
	"Other|Other#" +
	"Pop|Pop#" +
	"Pop Punk|Pop Punk#" +
	"Powerpop|Powerpop#" +
	"Progressive|Progressive#" +
	"Psychedelic|Psychedelic#" +
	"Psychobilly|Psychobilly#" +
	"Punk|Punk#" +
	"RnB|RnB#" +
	"Rap|Rap#" +
	"Reggae|Reggae#" +
	"Rock|Rock#" +
	"Rockabilly|Rockabilly#" +
	"Ska|Ska#" +
	"Soul|Soul#" +
	"Southern Rock|Southern Rock#" +
	"Surf|Surf#" +
	"Techno|Techno#" +
	"Thrash|Thrash#" +
	"Trance|Trance#" +
	"Trip-Hop|Trip-Hop#" +
	"Turntablism|Turntablism#" +
	"World|World",
"Cyber Gallery*All|All#" +
	"Abstract|Abstract#" +
	"Acrylic Painting|Acrylic Painting#" +
	"African|African#" +
	"Animals|Animals#" +
	"Art Deco|Art Deco#" +
	"Art Nouveau|Art Nouveau#" +
	"Asian|Asian#" +
	"Baroque|Baroque#" +
	"Cartoonism|Cartoonism#" +
	"Celtic|Celtic#" +
	"Ceramics|Ceramics#" +
	"Chalk|Chalk#" +
	"Cityscape|Cityscape#" +
	"Classicism|Classicism#" +
	"Computer Art|Computer Art#" +
	"Conceptual|Conceptual#" +
	"Countryscape|Countryscape#" +
	"Crafts|Crafts#" +
	"Cubism|Cubism#" +
	"Dadaism|Dadaism#" +
	"Erotic|Erotic#" +
	"Etching|Etching#" +
	"Expressionism|Expressionism#" +
	"Fantasy|Fantasy#" +
	"Fauvism|Fauvism#" +
	"Figurative|Figurative#" +
	"Floral|Floral#" +
	"Folk Art|Folk Art#" +
	"Glass|Glass#" +
	"Gothic|Gothic#" +
	"Graffiti|Graffiti#" +
	"Graphite|Graphite#" +
	"Illustration|Illustration#" +
	"Impressionism|Impressionism#" +
	"Ink|Ink#" +
	"Installation|Installation#" +
	"Landscape|Landscape#" +
	"Leatherwork|Leatherwork#" +
	"Lithography|Lithography#" +
	"Latin American|Latin American#" +
	"Minimalism|Minimalism#" +
	"Modern|Modern#" +
	"Native American|Native American#" +
	"Oil Painting|Oil Painting#" +
	"Otherscape|Otherscape#" +
	"Pencil|Pencil#" +
	"Photography|Photography#" +
	"Photorealism|Photorealism#" +
	"Pop Art|Pop Art#" +
	"Portrait|Portrait#" +
	"Postimpressionism|Postimpressionism#" +
	"Postmodern|Postmodern#" +
	"Primitivism|Primitivism#" +
	"Printmaking|Printmaking#" +
	"Pyrography|Pyrography#" +
	"Realism|Realism#" +
	"Religious|Religious#" +
	"Romanticism|Romanticism#" +
	"Sculpture|Sculpture#" +
	"Seascape|Seascape#" +
	"Still Life|Still Life#" +
	"Subjectivism|Subjectivism#" +
	"Surrealism|Surrealism#" +
	"Symbolism|Symbolism#" +
	"Watercolor|Watercolor#" +
	"Wildlife|Wildlife#" +
	"Woodwork|Woodwork",
"Film & Video*All|All#" +
	"Action|Action#" +
	"Adventure|Adventure#" +
	"Animation|Animation#" +
	"Avant Garde|Avant Garde#" +
	"B-rate|B-rate#" +
	"Biography|Biography#" +
	"Comedy|Comedy#" +
	"Crime|Crime#" +
	"Documentary|Documentary#" +
	"Drama|Drama#" +
	"Family|Family#" +
	"Film-Noir|Film-Noir#" +
	"History|History#" +
	"Home Movie|Home Movie#" +
	"Horror|Horror#" +
	"Martial Arts|Martial Arts#" +
	"Music Video|Music Video#" +
	"Mystery|Mystery#" +
	"News|News#" +
	"Reality-Show|Reality-Show#" +
	"Romance|Romance#" +
	"Sci-Fi|Sci-Fi" +
	"Short|Short#" +
	"Thriller|Thriller#" +
	"War|War#" +
	"Western|Western",
"Fashion*All|All#" +
	"Spring|Spring#" +
	"Summer|Summer#" +
	"Fall|Fall#" +
	"Winter|Winter#" +
	"Accessories|Accessories#" +
	"African|African#" +
	"Asian|Asian#" +
	"Celtic|Celtic#" +
	"Childrens|Childrens#" +
	"Costumes|Costumes#" +
	"Experimental|Experimental#" +	
	"Fetish|Fetish#" +
	"Gothic|Gothic#" +
	"Gym|Gym#" +
	"Hawaiian|Hawaiian#" +
	"High Fashion|High Fashion#" +
	"Historical|Historical#" +
	"Indian|Indian#" +
	"Lingerie|Lingerie#" +
	"Mod|Mod#" +	
	"Other|Other#" +
	"Outdoor-wear|Outdoor-wear#" +
	"Punk|Punk#" +
	"Retro|Retro#" +
	"Skateboard|Skateboard#" +
	"Sports|Sports#" +
	"T-shirts|T-shirts#" +
	"Uniforms|Uniforms#" +
	"Vintage|Vintage#" +
	"Wedding|Wedding",
"Books*All|All#" +
	"Art|Art#" +
	"Biography|Biography#" +
	"Body-Mind-Spirit|Body-Mind-Spirit#" +
	"Business & Economics|Business & Economics#" +
	"Children's Fiction|Children's Fiction#" +
	"Children's Nonfiction|Children's Nonfiction#" +
	"Cookbooks|Cookbooks#" +
	"Computers|Computers#" +
	"Crime|Crime#" +
	"Drama|Drama#" +
	"Education|Education#" +
	"Erotic|Erotic#" +
	"Fantasy|Fantasy#" +
	"Fiction|Fiction#" +
	"Gardening|Gardening#" +
	"Health & Fitness|Health & Fitness#" +
	"History|History#" +
	"House & Home|House & Home#" +
	"Humour|Humour#" +
	"Law|Law#" +
	"Military|Military#" +
	"Music|Music#" +
	"Nature|Nature#" +
	"Nonfiction|Nonfiction#" +
	"Pets|Pets#" +
	"Photography|Photography#" +
	"Poetry|Poetry#" +
	"Political Science|Political Science#" +
	"Psychology & Psychiatry|Psychology & Psychiatry#" +
	"Reference|Reference#" +
	"Religion|Religion#" +
	"Romance|Romance#" +
	"Sci-Fi|Sci-Fi#" +
	"Science|Science#" +
	"Self-Help|Self-Help#" +
	"Sports & Recreation|Sports & Recreation#" +
	"Technical|Technical#" +
	"Technology|Technology#" +
	"Thriller|Thriller#" +
	"Transportation|Transportation#" +
	"Travel|Travel");
/*****************************************************************/
function stringSplit ( string, delimiter ) {
    if ( string == null || string == "" ) {
   return null ;
    } else if ( string.split != null ) {
   return string.split ( delimiter ) ;
    } else {
   var ar = new Array() ;
   var i = 0 ;
   var start = 0 ;
   while( start >= 0 && start < string.length ) {
       var end = string.indexOf ( delimiter, start ) ;
       if( end >= 0 ) {
      ar[i++] = string.substring ( start, end ) ;
      start = end+1 ;
       } else {
      ar[i++] = string.substring ( start, string.length ) ;
      start = -1 ;
       }
   }
   return ar ;
    }
}
/**************************************************************/
function updateMenus ( what ) {
   var n = what.selectedIndex;
   what.form.myLinks.length = final_list[n].title.length;
   for (var x = 0; x < what.form.myLinks.length; x++)
   {
      what.form.myLinks.options[x].text = final_list[n].title[x];
      what.form.myLinks.options[x].value = final_list[n].url[x]; 
   }
   what.form.myLinks.selectedIndex = 0;
}
/**************************************************************/
function give_names () {
   document.myForm.main.length = names.length;
   document.myForm.myLinks.length = final_list[0].title.length;
   for ( var i=0; i<names.length; i++ )
      document.myForm.main.options[i].text = final_list[i].name;
	for (var x=0; x<final_list[0].url.length; x++)
      document.myForm.myLinks.options[x].text = final_list[0].title[x];
}
/**************************************************************/
function createMenus () {
   for ( var i=0; i<menu.length; i++ )
   {
		names[i] = stringSplit (menu[i], '*' );
      link = new Link(names[i][0]);
      temp[i] = stringSplit(names[i][1], '#');
		final_list[i] = link;
		for (var x=0; x<temp[i].length; x++)
		{
	      temp2[x]  = stringSplit( temp[i][x], '|' );
			final_list[i].url[x] = temp2[x][0];
			final_list[i].title[x] = temp2[x][1];
		}
	}
give_names();
}

function clearkeywords () {
    document.myForm.keywords.value = "";

}


function OpenWindow(windowname2, poplocation2, width2, height2) {

var winl = (screen.width - width2) / 2;
var wint = (screen.height - height2) / 2;

settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width=" + width2 + 
",height=" + height2 + 
",top=" + wint + ",left=" + winl;

NewWindow = window.open("",windowname2,settings);
NewWindow.location.href = poplocation2;


if (NewWindow.opener == null) NewWindow.opener = window;

}
