function ClickCounter( n ) {
	this.c = n;
	
	this.Tick = function() {
		this.c ++;
	}

	this.getTicks = function() {
		return this.c;
	}

	this.getMTicks = function() {
		return -this.c;
	}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function alarm( n ) {
	this.n = n;
	this.fired = false;
	
	this.fire = function() {
		this.fired = true;
	}
	
	this.wasFired = function() {
		return this.fired;
	}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function MM_openBrWindow(theURL,winName,features) { //v2.0  
	window.open(theURL,winName,features);
  return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function large_sample(fn,w,h) {
	if ( w>0 && h>0 )
		MM_openBrWindow('popup.php?fn='+fn,'','scrollbars=no,width='+w+',height='+h+',top=0,screenY=0,left=0,screenX=0');
}	
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function validate_email(strng, m1, m2, m3) {
	var error="";
	if (strng == "") {
		if ( m1 != '' )
	   		alert( m1 );
	   return false;
	}

    var emailFilter=/^.+@.+\..{2,}$/;
    if (!(emailFilter.test(strng))) { 
		if ( m2 != '' )
    		alert( m2 );
		return false;
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\'\[\]]/
         if (strng.match(illegalChars)) {
			if ( m3 != '' )
		    	alert( m3 );
			return false;
       }
    }
return true;    
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function getElementByName(element_name,element_tag) 
{
	var l = document.getElementsByTagName(element_tag);
	for ( var i = 0; i < l.length; i ++ ) {
		if ( l.item(i).name==element_name )
			return l.item(i);
	}
	return undefined;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function getElementById(element_id) 
{
	if (document.getElementById) {
		return document.getElementById(element_id);
	}
	else if (document.all) {
		return document.all[element_id];
	}
	else if (document.layers) {
		return document.layers[element_id];
	} else {
		return undefined;
	}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function leftTrim(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	return sString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function rightTrim(sString) {
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function trimAll(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function abContainer(n) {
	this.cname = n;
	this.items = new Array();
	this.selectedItem = 0;
	
	this.addItem = function( itemId ) {
		var i = this.items.length;
		this.items[i] = itemId; 		
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function errorMessage( c, t ) {
	this.em_code = c;
	this.em_text = t;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function errorMessages() {
	this.e_messages = new Array();
	
	this.addErrorMessage = function( c, t ) {
		this.e_messages[this.e_messages.length] = new errorMessage( c, t );
	}
	
	this.findErrorMessage = function( c ) {
		em = '';
		for ( var i = 0; i < this.e_messages.length; i ++ ) {
			if ( this.e_messages[i].em_code == c ) {
				return this.e_messages[i].em_text;
			}
		}
		return '';
	}
}				

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function aussieBum( n, pp ) {
	
	this.ids = new Array();
	this.cat = new Array();
	this.txt = new Array();
	this.items_no = n;
	this.pp = pp;

	this.itemAdded = '';
	this.addToBag = '';
	this.checkoutGrey = '';
	this.checkoutRed = '';
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.addUnavailableChoice = function( id, cat, txt ) {
		this.ids[this.ids.length] = id;
		this.cat[this.cat.length] = cat;
		this.txt[this.txt.length] = txt;
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.isChoiceAvailable = function( id, cat ) {
		var i;
		for ( i = 0; i < this.ids.length; i ++ )
			if ( this.ids[i] == id && this.cat[i] == cat )
				return this.txt[i];
		return '';
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.createDoor = function() {
		var t;
//		t = '<iframe frameborder="NO" border="0" height="200" width="200" framespacing="0" id="door" name="door" src="'+this.pp+'common/terminator.php" style="position:absolute;top:0;left:0;display:block;" style_bak="display:none;"></iframe>';
		t = '<iframe frameborder="NO" border="0" height="0" width="0" framespacing="0" id="door" name="door" src="'+this.pp+'common/terminator.php" style="position:absolute;top:0;left:0;visibility:hidden;"></iframe>';
		document.write( t );
	};
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.emailFriend = function( f, em ) {
		var i;
		var t = '';
		for ( i = 0; i < document.forms.length; i ++ ) {
			t += i + ':' + document.forms[i].name + ' ';
		}
		
		if ( ! validate_email( f.to_address.value , '', '', '' ) ) {
			alert( em );
			f.to_address.focus();
			return false;
		}
		
		if ( ! validate_email( f.from_address.value , '', '', '' ) ) {
			alert( em );
			f.from_address.focus();
			return false;
		}
			
       	emailFriendForm.target = 'door';
        emailFriendForm.action = this.pp+'common/emailafriend.php';
        emailFriendForm.submit();
        slideShow.Show();
	
		return false;
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.setCartButtons = function( itemAdded, addToBag, checkoutGrey, checkoutRed ) {
		this.itemAdded = itemAdded;
		this.addToBag = addToBag;
		this.checkoutGrey = checkoutGrey;
		this.checkoutRed = checkoutRed;
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.resetButtons = function() {
		var el = getElementById( 'b_addtobag' );
		if ( el != undefined )
			el.src = this.addToBag;

		el = getElementById( 'b_checkout' );
		if ( el != undefined )
		{
			if ( this.items_no == 0 )
				el.src = this.checkoutGrey;
			else
				el.src = this.checkoutRed;
		}
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.doCheckout = function( f ) {
		if ( this.items_no > 0 )
	        location = 'index.php?checkout=1';
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.addToCart = function( f, qty_err_msg, lc ) {
		var t;
		var d = new Date();
		var ts = d.getTime();

		if ( cartForm.mysize ) {
			t = this.isChoiceAvailable( cartForm.mysize.value, 'size' );
			if ( t != '' )
			{
				alert( t );
				return false;
			}
		}
		if ( cartForm.logo ) {
			t = this.isChoiceAvailable( cartForm.logo.value, 'logo' );
			if ( t != '' )
			{
				alert( t );
				return false;
			}
		}
		var qty;
		qty = parseInt( cartForm.qty.value );
		if ( ! ( qty > 0 ) ) {
			alert( qty_err_msg );
			return false;
		}
/*
		var el = getElementById( 'cart_add' );
		if ( el != undefined )
			el.src = '../../img/cart/itemadded_' + lc + '.gif';
*/
b_add2cart.set( '../../img/cart/itemadded' );
setTimeout('b_add2cart.breset();', 3000);
		if ( this.items_no == 0 && qty > 0 ) {
			el = getElementById( 'mainCheckoutButton' );
			if ( el != undefined )
				el.innerHTML = mainCheckoutButton;
			el = getElementById( 'bottomCheckoutButton' );
			if ( el != undefined )
				el.innerHTML = bottomCheckoutButton;
		}
		
		this.items_no += qty;
       	
       	cartForm.target = 'door';
       	cartForm.timestamp.value = cartForm.modelid.value + '_' + ts;
        cartForm.action = this.pp+'common/add2cart.php';
        cartForm.submit();
        
	
		return false;
	}
	
	this.bell = function() {
		alert( 'bell!' );
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showThumbnail2( ) {
	var i,p,v,v1,vv,obj,args=showThumbnail2.arguments;
	var l;
	l = '';
	
	for ( i = 0; i < (args.length); i+=2) 
		if ((obj=getElementById('it_'+args[i]))!=undefined) { 
			vv=args[i+1];
    		if (obj.style) 
    			{ obj=obj.style; v1=(vv==1)?'block':'none'; v=(vv==1)?'visible':'hidden'; l+='it_'+args[i]+'.style.visibility='+v+'; '; }
    		else
    			l += 'missed '+'it_'+args[i]+'; ';
    		obj.display=v1; 
    		obj.visibility=v; 
    	}
    	else
			l += 'Missed '+'it_'+args[i]+'; ';
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function showThumbnail() {
	var i,p,v,obj,args=showThumbnail.arguments;
	
	for ( i = 0; i < (args.length); i+=2) if ((obj=getElementById('it_'+args[i]))!=undefined) { 
		v=args[i+1];
    	if (obj.style) 
    		{ obj=obj.style; v=(v==1)?'visible':'hidden'; }
    	obj.visibility=v; 
    }
	
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function signUp( f, em, pp ) {
	this.form = getElementById( f );
	this.em = em;
	this.touched = false;
	this.pp = pp;
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.on_Touch = function( f ) {
		if ( ! this.touched ) {
			f.value = '';
			this.touched = true;
		}
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.on_Submit = function( f ) {
		return false;
/*		
		if ( ! validate_email( f.mail.value , '', '', '' ) ) {
			alert( this.em );
			f.mail.focus();
			return false;
		}
		
       	f.target = 'door';
        f.action = '../common/signup.php';
        f.submit();
        

        var el = getElementById( 's_signup' );
        if ( el != undefined )
        	el.innerHTML = '&nbsp;'

		return true;
*/		
	}
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
	this.signUp = function( ff ) {
		var f = this.form;
		if ( ! validate_email( f.mail.value , '', '', '' ) ) {
			alert( this.em );
			f.mail.focus();
			return false;
		}
		
       	f.target = 'door';
        f.action = pp+'common/signup.php';
        f.submit();
        

        var el = getElementById( 's_signup' );
        if ( el != undefined ) {
        	el.style.display = 'none';
//        	el.innerHTML = '&nbsp;'
        }
	}
}

function siTab( n ) {
	var i;
	var el;
	var sel;
	var nm;
	
	
	for ( i = 1; i < 5; i ++ ) {
		if ( i == n )
			sel = '1';
		else
			sel = '2';

		el = getElementById('sit1' + i);
		if ( el != undefined ) {
			el.className = 'sit1' + sel;
		}
			
		el = getElementById('sit2' + i);
		if ( el != undefined )
			el.className = 'sit2' + sel;
	}
}
			
			
			
function styleList_jumpToPage( n1, n ) {
	var i, el, vis;
	for ( i = 0; i < n; i ++ ) {
		vis = 'hidden';
		disp = 'none';
		if ( i == n1 ) {
			vis = 'visible';
			disp = 'block';
		}
		el = getElementById('style_list_p' + i);
		if ( el != undefined )
			el.style.visibility = vis;

		el = getElementById('tab_p' + i);
		if ( el != undefined )
			el.style.display = disp;
	}
}

function showThumbnail( n1, n ) {
	var i, el, vis;
	for ( i = 0; i < n; i ++ ) {
		el = getElementById('it_' + i);
		vis = 'hidden';
		if ( i == n1 )
			vis = 'visible';
		if ( el != undefined )
			el.style.visibility = vis;
	}
}

function showListThumbnail(n1,n,id) {
//alert('asd' + id);
	var i, el, vis;
	for ( i = 0; i < n; i ++ ) {
		el = getElementById('it_'+ id + '_' + i);
		vis = 'hidden';
		if ( i == n1 )
			vis = 'visible';
		if ( el != undefined ){
		//alert('it_'+ id + '_' + i + '---->' + getElementById('it_'+ id + '_' + i).style.visibility);
			el.style.visibility = vis;
			}
			
	}
	
}
function showListThumbnailOut()
{}
			
function buttonToPlay( bid, bfn, lc ) {
	this.bid = bid;
	
	this.bfn = bfn;
	this.bfn0 = bfn;
	this.lc = lc;
	
	this.mover = function() {
		var el;
		if ( ( el = getElementById( this.bid ) ) != undefined ) {
			el.src = this.bfn + '_' + this.lc + '_f2.gif';
		}
	}
	this.mout = function() {
		var el;
		if ( ( el = getElementById( this.bid ) ) != undefined )
			el.src = this.bfn + '_' + this.lc  + '.gif';
	}
	this.set = function( fn ) {
		this.bfn = fn;
		this.mover();
	}
	this.breset = function() {
		this.bfn = this.bfn0;
		this.mout();
	}
	this.breset2 = function() {
clearTimeout();
setTimeout("b_add2cart.breset()",1250);
		this.mout();
	}
	this.item_added = function() {
		var el;
		this.bfn = '../../img/cart/itemadded';
		if ( ( el = getElementById( this.bid ) ) != undefined ) {
			el.src = this.bfn + '_' + this.lc + '_f2.gif';
		}
	}
}
	

function showIP( id ) {
	var i, el;
	ids = new Array();
	ids[0] = 'id';
	ids[1] = 'wd';
	ids[2] = 'ef';
	ids[3] = 'pr';
	if ( getElementById('ip_'+id) == undefined )
		return;
	
	for ( i = 0; i < 4; i ++ ) {
		if ( ids[i] == id ) {
			if ( ( el = getElementById('ip_'+ids[i]) ) != undefined ) {
				el.style.display = 'block';
				el.style.visibility = 'visible';
			}
			if ( ( el = getElementById('ip_'+ids[i]+'t') ) != undefined ) {
				el.className = 'tab_txt_s';
			}
			if ( ( el = getElementById('ip_'+ids[i]+'tl') ) != undefined ) {
				el.className = 'tab_left_s';
			}
		}
		else {
			if ( ( el = getElementById('ip_'+ids[i]) ) != undefined ) {
				el.style.display = 'none';
				el.style.visibility = 'hidden';
			}
			if ( ( el = getElementById('ip_'+ids[i]+'t') ) != undefined ) {
				el.className = 'tab_txt';
			}
			if ( ( el = getElementById('ip_'+ids[i]+'tl') ) != undefined ) {
				el.className = 'tab_left';
			}
		}
	}
}				