$(document).ready(function() {
   
   $("[@rel='auto']").each(function(i){
					 
		var mytab = $(this).attr('mytable');			 
    	$(this).autocomplete(GLOBAL_PATH+"/index.php?main=registeration&sub=ajax_auto&process=1", 
								 { 
								 minChars:2, 
								 autoFill:false,
								 selectFirst:false,
								 maxItemsToShow:10,
								 extraParams: { 
								 				'table': mytab 
											  }
								 }); 
   });
	
    
	
});

function showhide(elemid) {
	$(elemid).slideToggle();
}
function showhidesec(elemid) {
	$("[@relsh="+elemid+"]").slideToggle();
}

function warn() {
	if(confirm("Are you sure you want to delete the selected product?")) 
	return true;
	else
	return false;
}

function LimitAttach(myvar) {
	var file = $(myvar).val();
	extArray = new Array(".gif", ".jpg", ".jpeg", ".png");
	allowSubmit = false;
	if (!file) return false;
	ext = file.slice(file.lastIndexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = true; break; }
	}
	
	if(allowSubmit==false) {
	alert('Please select the image file with .gif, .jpg, .jpeg, .png extension');		
	$(myvar).val('');
	}
		
	//alert(allowSubmit);
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

<!-- Hide Script
	function move_in(img_name,img_src) {
	document[img_name].src=img_src;
	}

	function move_out(img_name,img_src) {
	document[img_name].src=img_src;
	}
//End Hide Script-->

var useBSNns;
if (useBSNns)
{
if (typeof(bsn) == "undefined")
bsn = {}
var _bsn = bsn;
}
else
{
var _bsn = this;
}
_bsn.Crossfader = function (divs, fadetime, delay )
{ 
this.nAct = -1;
this.aDivs = divs;
for (var i=0;i<divs.length;i++)
{
document.getElementById(divs[i]).style.opacity = 0;
//document.getElementById(divs[i]).style.position = "absolute";
document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
document.getElementById(divs[i]).style.display = "none";
}
this.nDur = fadetime;
this.nDelay = delay;
document.getElementById( this.aDivs[0] ).style.display = "block";
this._newfade();
}
_bsn.Crossfader.prototype._newfade = function()
{
if (this.nID1)
clearInterval(this.nID1);
this.nOldAct = this.nAct;
this.nAct++;
if (!this.aDivs[this.nAct]) this.nAct = 0;
if (this.nAct == this.nOldAct)
return false;
//document.getElementById( this.aDivs[this.nAct] ).style.display = "block";
this.nInt = 50;
this.nTime = 0;
var p=this;
this.nID2 = setInterval(function() { p._fade() }, this.nInt);
}
_bsn.Crossfader.prototype._fade = function()
{
this.nTime += this.nInt;
var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 );
var op = ieop / 100;
document.getElementById( this.aDivs[this.nAct] ).style.opacity = op;
document.getElementById( this.aDivs[this.nAct] ).style.filter = "alpha(opacity="+ieop+")";
if (this.nOldAct > -1)
{
document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op;
document.getElementById( this.aDivs[this.nOldAct] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
}
if (this.nTime == this.nDur)
{
clearInterval( this.nID2 );

if (this.nOldAct > -1)
{
document.getElementById( this.aDivs[this.nOldAct] ).style.display = "none"; 
document.getElementById( this.aDivs[this.nAct] ).style.display = "block";
}

var p=this;
this.nID1 = setInterval(function() { p._newfade() }, this.nDelay);
}
}
_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d)
{
return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}


function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
} 

