function y( o) {
	var t = 0;
	while (o != null) {
		t += o.offsetTop;
		o = o.offsetParent;
	}
	return t;
}

function idobj( id) {
	return document.getElementById(id);
}
function ondisplay( id) {
	var os = document.getElementById(id).style;
	os.display = os.display=="block"?"none":"block";
	return false;
}
function xflipper() {
try {
	var o = document.getElementById("xflip");
	if (typeof o=="object") {
		o.style.visibility = o.style.visibility=="visible"?"hidden":"visible";
	}
	setTimeout("xflipper()",500);
} catch (e) {}
}

function setup() {
	xflipper();
}

// attention! './' in urls for ext_video is essential
// urls should be WITHOUT ../ for ext_***, while WITH it for plain imgs in pages' code

function ext_img( p, w, h, title) {
 win = window.open('','album_img_'+parseInt((Math.random()*1000000),10),'location=no,status=no,menubar=no,toolbar=no,resizable=no,width='+w+',height='+h);
 win.document.write('\
<html><head><title>'+title+'</title></head>\
<body marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>\
<img src="./../'+p+'" width='+w+' height='+h+' hspace=0 vspace=0 alt="">\
</body></html>\n\n');
}

function ext_video( v, w, h, title) {
 win = window.open('','ishop_video_'+parseInt((Math.random()*1000000),10),'location=no,status=no,menubar=no,toolbar=no,resizable=no,width='+(w+2)+',height='+(h+62));
 win.document.write('<html><head><title>'+title+'</title></head>\
<body marginheight=0 topmargin=0 leftmargin=0 marginwidth=0>\
<object width='+w+' height='+(h+62)+'\
	CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"\
	type="application/x-oleobject">\
	<param name=url value="./../'+v+'">\
	<param name=autostart value=true>\
	<param name=uimode value=mini>\
	<param name=playcount value=1>\
	<embed src="./../'+v+'" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" width='+w+' height='+(h+45)+' autostart=true uimode=mini></embed>\
</object></body></html>\r\n\r\n');
}

function ext_flv( v, w, h, title) {
 win = window.open('','ishop_video_'+parseInt((Math.random()*1000000),10),'location=no,status=no,menubar=no,toolbar=no,resizable=no,width='+w+',height='+(h+40));
 win.document.write('<html><head><title>'+title+'</title>\
<script type=\'text/javascript\'>var _swfobject_loaded = false;</'+'script>\
<script type=\'text/javascript\' src=\'./../ext/swfobject.js\'></'+'script>\
</head>\
<body marginheight=0 topmargin=0 leftmargin=0 marginwidth=0 bgcolor=black>\
<div id="player1" style="margin:0;padding:0;color:white;font-family:Verdana;font-size:10pt;"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>\
<script type="text/javascript">\
function show_player() {\
if (!_swfobject_loaded) {\
setTimeout("show_player()",50);\
return;\
}\
var s1 = new SWFObject("./../ext/flvplayer.swf","single","'+w+'","'+(h+20)+'","7");\
s1.addParam("allowfullscreen","true");\
s1.addVariable("file","./../'+v+'");\
s1.addVariable("autostart","true");\
s1.write("player1");\
}\
show_player();\
</'+'script>\
<div align=right style=\'padding:0;margin:3px 3px 0 0;color:white;font-family:Verdana;font-size:8pt;\'>Flv Flash Player</div>\
</body></html>\r\n\r\n');
}


function swap_prop( id, sub, prop, state, state_true, state_false) {
 var o = document.getElementById(id);
 if (sub) { o = o[sub]; }
 o[prop] = ((state)?state_true:state_false);
}

function ishop_set_bdata( id) {
 t = id.substr(3,1);
 id = id.slice(5);

 if (t == 1) {
  document.getElementById('num_id1').value = document.getElementById('num_'+id).value;
 }

 document.getElementById('id_id'+t).value = id;
 document.getElementById('f_'+t).submit();
}

function chk_lnk( i, j) {
 var o1 = document.getElementById('id'+i);
 var o2 = document.getElementById('id'+j);

 if ((!o1.checked)&&(!o2.checked)) {
  o1.checked = true;
 }

 var v2 = document.getElementById('id2');

 if (i == 3) {
  if (!o1.checked) {
   if (v2.checked) { v2.click(); }
   v2.disabled = true;
  } else {
   v2.disabled = false;
  }
 }

}

function users_set_data( mode, id) {
 document.getElementById('u_id1').value = mode;
 document.getElementById('u_id2').value = id;
 document.getElementById('f_1').submit();
}

// base64 js decoding routine
// may, 2005 // by morgan
// the code works correctly only with ascii-127 base64 encoded chars
// (as fromCharCode likes the unicode)

var base64_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var base64_keys = [];
for ( var i=0; i<=64; i++) {
 base64_keys[base64_chars.charAt(i)] = i;
}

function base64_decode( s) {
 if ((s.length&3)||(!s.match(/^[a-z0-9+\/]+={0,2}$/i))) {
  return ''; // invalid input
 }

 var i = 0, rz = '', n = s.length;
 while (i < n) {
  k = base64_keys[s.charAt(i++)]<<18|
      base64_keys[s.charAt(i++)]<<12|
      base64_keys[s.charAt(i++)]<<6|
      base64_keys[s.charAt(i++)];

  rz += String.fromCharCode(k>>16,(k>>8)&0xff,k&0xff);
 }

 if ((i = s.indexOf('=')) != -1) {
  rz = rz.substr(0,rz.length-(n-i));
 }

 return rz;
}