/////////////// document ready ///////////////
$(document).ready(function() {
	$('select').replaceSelects({
		replaceForIphone: false
	});
});


//////////////////////////////////// Preload

/*

var imgFile = [

	'/img/men2d2.gif',

	'/img/mencont2.gif'

];



var imgObj = [];

for(var i=0; i<imgFile.length; i++) {

  imgObj[i] = new Image();

  imgObj[i].src = imgFile[i];

}

*/

function re(cels) {
	document.location.href=cels;	
}

//////////////////////////////////// Show / Hide

function showhide(hidewhat){
	hideobject = document.getElementById(hidewhat);
	hideobject.style.display = hideobject.style.display == "none" ? "" : "none";
}

function show(showwhat){
	showobject = document.getElementById(showwhat);
	showobject.style.display = "";
}

function hide(hidewhat){
	hideobject = document.getElementById(hidewhat);
	hideobject.style.display = "none";
}

function showclass(whatclass){
	var objs = getElementsByClass(whatclass);
	for(i=0; i<objs.length; i++){
		objs[i].style.display = "";
	}
}

function hideclass(whatclass){
	var objs = getElementsByClass(whatclass);
	for(i=0; i<objs.length; i++){
		objs[i].style.display = "none";
	}
}

function showhideclass(whatclass){
	var objs = getElementsByClass(whatclass);
	for(i=0; i<objs.length; i++){
		objs[i].style.display = objs[i].style.display=="none" ? "" : "none";
	}
}

//////////////////////////////////// Enter only numbers

function isNumberKey(evt) {
	var typedChar = evt.keyCode ? evt.keyCode : evt.which ? evt.which : evt.charCode;
	if((typedChar >= 48 && typedChar <= 57) || typedChar == 8 || typedChar == 37 || typedChar == 39 || typedChar == 46) {
		return true;
	}else {
		return false;
	}
}

//////////////////////////////////// Get Elements by Class

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

//////////////////////////////////// Fix IE6 Flickering

function fixIE6flicker(fix) {
	try {
		document.execCommand("BackgroundImageCache", false, fix);
	} catch(err) { }
}
fixIE6flicker(true);

/////////////////////////// AJAX functions //////////////////////
function get_galpic(record_id)
{
	var p = {};
     p['pic_id'] = record_id;
	$('#galpic').load("/content_show/gallpicget",p,function(str){
		
	});
}

function get_leftcontent(record_id,page_id)
{
	var p = {};
     p['pic_id'] = record_id;
	 p['page_id'] = page_id;
	$('#galpic').load("/content_show/leftcontentget",p,function(str){
		
	});
}

function get_bodytxt(record_id)
{
	var p = {};
     p['page_id'] = record_id;
	$('#galpic').load("/content_show/bodytxtget",p,function(str){
		
	});
}
