$(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();
    }
  }
}