
my_url 		= 'http://www.sabertrontoys.com/';
bpath 		= '/';
d_php 		= bpath + 'ajax.php';
/***************************/
// Runs after page loads.
/***************************/
function load(){
	//setTall();
	clearInput();
	
}
/***************************/
// Set Side Column to Height of Main Column.
// If Main Column is less than desired Minimum, set to minimum.
/***************************/
minColHeight = 550;
function setTall() {
	if (document.getElementById) {
		// the divs array contains references to each column's div element.  
		var divs = new Array(document.getElementById('main_column'), document.getElementById('side_column'));
		if(divs[1] != null){
			if(divs[1].offsetHeight < divs[0].offsetHeight){
			// Let's determine the maximum height out of all columns specified
			var maxHeight = 0;
			for (var i = 0; i < divs.length; i++) {
				var h = divs[i].offsetHeight;
				if( i == 1) h += 100;
				if (h > maxHeight) maxHeight = h;
			}
			
			if(maxHeight < minColHeight) maxHeight = minColHeight;
			
			// Let's set all columns to that maximum height
			
			for (var i = 1; i < divs.length; i++) {
				divs[i].style.height = maxHeight + 'px';
	
				// Now, if the browser's in standards-compliant mode, the height property
				// sets the height excluding padding, so we figure the padding out by subtracting the
				// old maxHeight from the new offsetHeight, and compensate!  So it works in Safari AND in IE 5.x
				if (divs[i].offsetHeight > maxHeight) {
					divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
				}
			}
			}
		}
	}
}
/***************************/
// Input clear.
/***************************/
function clearInput() {
 var inputs = getElementsByClassName('auto_clear');
 for(var i=0; i < inputs.length; i++) {
  inputs[i].setAttribute('rel',inputs[i].defaultValue);
  inputs[i].onfocus = function() {
   if (this.value == this.getAttribute('rel') && this.getAttribute('type') != 'submit' && this.getAttribute('type') != 'reset') {
    this.value = '';
   } else {
    return false;
   }
  }
  inputs[i].onblur = function() {
   if(this.value=='' && this.getAttribute('type') != 'submit' && this.getAttribute('type') != 'reset') {
    this.value = this.getAttribute('rel');
   } else {
    return false;
   }
  }
  inputs[i].ondblclick = function() {
   this.value = this.getAttribute('rel')
  }
 }
}
function getElementsByClassName(classname, node)  {
    if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}
/***************************/
// Transparent PNGs for IE.
/***************************/

jQuery.fn.supersleight = function(settings) {
	settings = jQuery.extend({
		imgs: true,
		backgrounds: true,
		shim: 'x.gif',
		apply_positioning: true
	}, settings);
	
	return this.each(function(){
		if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 7 && parseInt(jQuery.browser.version) > 4) {
			jQuery(this).find('*').each(function(i,obj) {
				var self = jQuery(obj);
				// background pngs
				if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
					var bg = self.css('background-image');
					var src = bg.substring(5,bg.length-2);
					var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
					var styles = {
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
						'background-image': 'url('+settings.shim+')'
					};
					self.css(styles);
				};
				// image elements
				if (settings.imgs && self.is('img[src$=png]')){
					var styles = {
						'width': self.width() + 'px',
						'height': self.height() + 'px',
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
					};
					self.css(styles).attr('src', settings.shim);
				};
				// apply position to 'active' elements
				if (settings.applyPositioning && self.is('a, input') && self.css('position') === ''){
					self.css('position', 'relative');
				};
			});
		};
	});
};

// limit to part of the page ... pass an ID to limitTo:
// supersleight.limitTo('header');
$(document).ready(function(){
	$('#header').supersleight({shim: bpath+'java/x.gif'});
	load();
});

// ===============================
//		Loading Bar
// ===============================
jQuery.fn.display_loader = function(id,msg){
	if (typeof msg == 'undefined' ) msg = 'Loading...';
	$(this).after("<div id='"+id+"' class='loading'><div class='notice_box'><img src='"+bpath+"java/icons/ajax-loader.gif' alt='loading...' style='padding:10px;'/> "+msg+"</div></div>");
	/*$('<img/>')
	.attr({
		'src': bpath + 'java/icons/ajax-loader.gif',
		'alt': 'loading...',
		'style': 'padding:10px;'
	}).wrap("<div style='padding:5px;' id='"+id+"'></div>"));*/
	return this;
}
// ==========================================================
//		OPTIONS_TO_QRY : Converts an array to URL variables.
// ==========================================================
options_to_qry = function(options){
	var qry = "?ajax_module=" + options['ajax_module'];
	for (var val in options){
		if(val != 'ajax_module') qry += "&" + val + "=" + options[val];
	}
	return qry;
};
// ===========================================
//		URLDECODE : PHP urldecode equivalent.
// ===========================================
function urldecode(data){
	return unescape(String(data).replace(/\+/g," "));
}	

// Dimensions.
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}))

