/* $Id: index20030514.js,v 1.1.2.2 2003/05/14 13:58:21 dima Exp $ */
	var buttonHREF = 'javascript:void(document.panel_do.submit())';
    window.name = 'main_fs_window';

	function select(img1,img2) {
	    if (img1 != 's0') 
			document.images[img1].src = eval(img2+".src");
	}

    function hide_shown_div(div_id) {
			document.getElementById(div_id).style.visibility = 'hidden';
	}

	function show_hidden_div(div_id,parent_id) {
		var div = document.getElementById(div_id);
		var parent = document.getElementById(parent_id);
		var delta = parent.offsetHeight - 1;
		// starting from 1.3 FreeBSD build has no -moz-opacity support :-(
		// this is workaround for the problem...
		if ( navigator.product == "Gecko" && navigator.oscpu.match('FreeBSD') )
			div.firstChild.setAttribute('style','');
			
		var ot = parent.offsetTop;
		var ol = parent.offsetLeft;
		while((parent = parent.offsetParent) != null) {
			ot += parent.offsetTop;
			ol += parent.offsetLeft;
		}
		div.style.left = ol + "px";
		div.style.top = ot + delta + "px";
		div.style.visibility = 'visible';
	}

	function get_normal_digits(tmp) {
		     tmp = tmp * 100;
		     tmp = Math.round(tmp);
		     tmp = tmp / 100;
			 tmp = tmp + '';
			 var aaa = tmp.split('.');
			 if (aaa.length == 1) {
				tmp = tmp + '.00';
			 } else {
			    if (aaa[1].length == 1) {
				   tmp = tmp + '0';
				}
			 }
			 return tmp;
	}

	function goto_directories() {
		window.open('/static/wait.html', 'wait', 'resizable=no,scrollbars=no,width=500,top=200,left=150,height=150,status=no,location=no,toolbar=no,menubar=no');
		document.location='/lounge/directories.html';
	}

	
	/* For Books */
	var buttonHREF = 'javascript:void(document.panel_do.submit())';
	var all_cat = "/category/all_books_by_category.html";
	var all_aut = "/category/all_books_by_author.html";
	var old_src = '';

	function ChangeIframe() {
	         var obj = document.getElementById('andy');
			 var new_src;
			 if (document.getElementById('cat').checked) {
				new_src = all_cat;
		 	 } else {
				new_src = all_aut;
			 }

			 if (old_src == new_src) {
			 } else { 
				obj.src = new_src;
			    old_src = obj.src;
			 }
			 return true
	}

	function _bm_cookie(name) {
		var s = document.cookie;
		var b = s.indexOf(name + '=');
		if (b==-1) return null; // no such name
		b = s.indexOf('=', b);
		s = s.substr(b+1);
		b = s.indexOf(';');
		if (b != -1) s = s.substr(0, b);
		return s;
	} // _bm_cookie
	
	function check_affiliate_code() {
	var myCookie = _bm_cookie('flightstore-univermag2-affiliatecode');
	if (myCookie != null) {
		if ( myCookie.length > 10 ){
			c = document.getElementById('page_affiliate_code');
			try {
				c.style.display = 'block';
				//c.style.marginBottom = '28px';
				//c.style.paddingBottom = '28px';
			} catch (e) {};
			a = document.getElementsByTagName('div');
			for ( i = 0; i<a.length; i++ )
				if ( a[i].className == 'affiliate_code' )
					a[i].style.display = 'block';
		}
	}
	}

	/*
var _bm_basket_value_cache;
function _bm_basket_value(number) {
    if (!_bm_basket_value_cache) {
        _bm_basket_value_cache = new Array();
        var c = unescape(_bm_cookie('BIGMAG-BASKET'));
        if (!c) return;
*/

	function brothChange(owner, aa, bb, cc) {
		     var myObject = document.getElementById(owner);
			 var needCheck = false;
			 if (myObject != null) {
				if (myObject.firstChild.firstChild.checked) {
					myObject.firstChild.firstChild.checked = false;
					myObject.firstChild.firstChild.onclick();
					needCheck = true;
				}
			 }
			 myObject = swapDivs(aa, bb, cc);
			 if (needCheck) {
				if (myObject != null) {
					myObject.firstChild.checked = true;
					myObject.firstChild.onclick();
				}
			 }
	}
	
	function swapDivs(thingToPlace, whereToPlace, removeFrom) {
		     var data;
	         var placeForContent = document.getElementById(whereToPlace);
			 if (placeForContent != null) {
			    data = document.getElementById(thingToPlace);
				if (data != null) {
					data = data.cloneNode(1);
					if (removeFrom > 0) {
						for (var i=0; i<data.childNodes.length; i++) {
							var myNode = data.childNodes[i];
							if (myNode.nodeName == 'INPUT') {
								var tmpValue = myNode.getAttribute('name');
								tmpValue = tmpValue.substr(removeFrom);
								myNode.setAttribute('name', tmpValue);
								myNode.setAttribute('id', tmpValue);
							}
						}
					}
					placeForContent.replaceChild(data, placeForContent.firstChild);
				    return data;
				}
			 }
			 
			 return null;
	}
