// JavaScript Document
function onClickCat(ID){
	var sPath = window.parent.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	alert(sPage);

	//$("#cats").hide();
	//$("#cats").load(sPage+"?catID="+catID+"&show=subcategories&isajax=true");
	//$("#cats").fadeIn("slow");
	
	//$("#catDetails").hide();	
	
	//window.parent.$("#Details").load(sPage+"?ID="+ID+"&show=catdetails&isajax=true");
	//$("#catDetails").fadeIn("slow");
	
	//$("#rightproducts").hide();
	window.parent.$("#rightproducts").load(sPage+"?ID="+ID+"&show=rightproducts&isajax=true");
	//$("#rightproducts").fadeIn("slow");
	//return;
}
//Redirect funtion for Alphabets
function alpharedir(page,alpha,pre)
{
	
	$.post('includes/checkitems.php',{page:page,alpha:alpha,pre:pre},function(data)
	{
		//alert(data);
		if(data==1)
		{
			window.location.href=page+'?alpha='+alpha+'&pre='+pre;
		}
		else
		{
			jAlert('No records in the selected range','No Records');
		}
	});
}
function onClickDetails(id){
	var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}

	//alert(sPage);

	//$("#cats").hide();
	//$("#cats").load(sPage+"?id="+id+"&show=selected&isajax=true");
	//$("#cats").fadeIn("slow");
	
	//$("#details").hide();
	$("#details").load(sPage+"?id="+id+"&show=details&isajax=true");
	//$("#details").fadeIn("slow");
	
	//$("#rightproducts").hide();
	//$("#rightproducts").load(sPage+"?catID="+catID+"&show=rightproducts&isajax=true");
	//$("#rightproducts").fadeIn("slow");
}
function barcodeDetails(id,isParent,catID){
	///alert(catID);
	if(isParent=='yes'){			
		var sPath = window.parent.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		if(sPage==''){
			sPage="index.php";
		}
		window.parent.$("#barcodedetails").load(sPage+"?catid="+catID+"&barcodeid="+id+"&show=barcodedetails&isajax=true");
		window.parent.$("#rightproducts").load(sPage+"?ID="+catID+"&show=rightproducts&isajax=true");
	}else{
		var sPath = window.location.pathname;
		var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
		if(sPage==''){
			sPage="index.php";
		}
		$("#barcodedetails").load(sPage+"?catid="+catID+"&barcodeid="+id+"&show=barcodedetails&isajax=true");
		//$("#rightproducts").load(sPage+"?ID="+catID+"&show=rightproducts&isajax=true");
	}	
	getpositions("barcodedetails");
	//parent.document.getElementById('gotodetails').focus();
}
function slideLogin(param)
{
		//window.parent.$("#barcodedetails").load(sPage+"?catid="+catID+"&barcodeid="+id+"&show=barcodedetails&isajax=true");
		//window.parent.$("#rightproducts").load(sPage+"?ID="+catID+"&show=rightproducts&isajax=true");
		//alert(param);
		$("#generaldiv").load("login.php?page="+param+" #dummydiv").slideUp(6000);
		//$("#generaldiv").slideUp();
}
function categoryItems(id,isParent,catID){
	var sPath = window.parent.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	window.parent.$("#barcodedetails").load(sPage+"?catid="+catID+"&barcodeid="+id+"&show=categories&isajax=true");
	window.parent.$("#rightproducts").load(sPage+"?ID="+catID+"&show=rightproducts&isajax=true");
}


function brandDetails(id){
	
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	$("#barcodedetails").load(sPage+"?brandid="+id+"&show=branddetails&isajax=true");
	$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");
	//document.getElementById('gotodetails').focus();
	getpositions("barcodedetails");
}

function onClickAllCat(catID){
	var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	sPage='index.php?catID='+catID;
	window.location=sPage;
	return;
	//alert(sPage);

	//$("#cats").hide();
	//$("#cats").load(sPage+"?catID="+catID+"&show=subcategories&isajax=true");
	//$("#cats").fadeIn("slow");
	
	//$("#catDetails").hide();
	//$("#catDetails").load(sPage+"?catID="+catID+"&show=catdetails&isajax=true");
	//$("#catDetails").fadeIn("slow");
	
	//$("#rightproducts").hide();
	//$("#rightproducts").load(sPage+"?catID="+catID+"&show=rightproducts&isajax=true");
	//$("#rightproducts").fadeIn("slow");
}

function Search(){
	
	var returnvalue='';
	document.frmsearch.txtsearch.style.border = '';
	document.frmsearch.cbosearch.style.border = '';		
	//alert("called");
	if(document.frmsearch.txtsearch.value=='' || document.frmsearch.txtsearch.value=='Keyword'){
		document.frmsearch.txtsearch.style.border = '2px solid #FF0000'	;
		document.frmsearch.txtsearch.value='';
		document.frmsearch.txtsearch.focus();		
		returnvalue='false';
	}
	if(document.frmsearch.cbosearch.value==''){
		document.frmsearch.cbosearch.style.border = '2px solid #FF0000'	;
		document.frmsearch.cbosearch.focus();
		returnvalue='false';
	}
	///this condition will redirect to the specific location
	var ids=document.frmsearch.testid.value;
	if(document.frmsearch.testid.value!=''){
		if(document.frmsearch.cbosearch.value=='index.php'){
			//window.location='categorydetails.php?catid='+ids;
			window.location='index.php?catid='+ids;
			return false;
		}if(document.frmsearch.cbosearch.value=='stores.php'){
			window.location='stores.php?storeid='+ids;
			return false;		
		}if(document.frmsearch.cbosearch.value=='recipes.php'){
			window.location='recipes.php?recipeid='+ids;
			return false;		
		}if(document.frmsearch.cbosearch.value=='brands.php'){
			//window.location='branddetails.php?brandid='+ids;
			window.location='index.php?brandid='+ids;
			return false;		
		}if(document.frmsearch.cbosearch.value=='clients.php'){
			window.location='clients.php?clientid='+ids;
			return false;		
		}if(document.frmsearch.cbosearch.value=='allitems.php'){
			window.location='index.php?barcodeid='+ids;
			
			return false;		
		}
	}else{
		if(returnvalue=='false'){
			return false;
		}
		else
		{
			document.frmsearch.txtsearch.style.border = '';
			document.frmsearch.cbosearch.style.border = '';	
			document.frmsearch.salpha.value='';
			var act="generalsearch.php";
			//alert(act);
			document.frmsearch.action=act;		
			document.frmsearch.submit();				
			return true;
		}
	}
}

function searchAlpha(alpha,sText,sFrom){
	var act="generalsearch.php";
		//alpha,sText,sFrom
	document.frmsearch.txtsearch.value=sText;
	document.frmsearch.cbosearch.value=sFrom;
	document.frmsearch.salpha.value=alpha;
	document.frmsearch.action=act;		
	document.frmsearch.page.value=0;	
	document.frmsearch.submit();
	//alert("called");
	//return true;
}
function redirectTo(pagename){	
	if(pagename=='brands.php'){
		window.location="allbrands.php";
	}else if(pagename=='index.php'){
		window.location="allcategories.php";
	}else{
		window.location=pagename;				
	}		
	return;
}

//==========================================
// Check All boxes
//==========================================
function CheckAll(fmobj,values) {
	//alert(fmobj.elements.length);
  for (var i=0;i<fmobj.elements.length;i++) {
    var e = fmobj.elements[i];
    if ((e.name != 'chkitem') && (e.type=='checkbox') && (!e.disabled) ) {
      e.checked = values;//fmobj.chkitem[i].checked;	  
	  //alert(e.name);
    }
  }
}

//==========================================
// Check all or uncheck all?
//==========================================
function CheckCheckAll(fmobj) {
  var TotalBoxes = 0;
  var TotalOn = 0;
  for (var i=0;i<fmobj.elements.length;i++) {
    var e = fmobj.elements[i];
    if ((e.name != 'allbox') && (e.type=='checkbox')) {
      TotalBoxes++;
      if (e.checked) {
       TotalOn++;
      }
    }
  }
  if (TotalBoxes==TotalOn) {
    fmobj.allbox.checked=true;
  }
  else {
   fmobj.allbox.checked=false;
  }
}
function changeScrollbarColor(C){
  if (document.all){
    
	
  }  
  document.body.style.scrollbarBaseColor = C
  alert(C);
}


/********************** Home page fuctions (Index.php) ************************/
function changeCat(catid){	
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	
	
	//$("#main-cat-div").load(sPage+"?ID="+catid+"&isajax=true&show=catdetails");
	//window.location=sPage+"?catid="+catid;
	/*$("div").each(function (i) {
       // if (this.style.color != "blue") {
        //  this.style.color = "blue";
        //} else {
        //  this.style.color = "";
        //}
		var divs=(this.id);
		if(((this.id).search("dummy"))>0){
			alert(this.id+"========="+(this.id.search("dummy")));
		
		}
      });
*/

$("#dummydiv").slideUp("fast");	
	loadcategories(catid);
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
//************************************************	
	/*$("#eventcatdiv").slideDown("slow");
	$("#detailsdiv").slideUp("slow");*/
	//getpositions("eventcatdiv");
	var top =$('#eventcatdiv').position().top;
	$('html, body').animate({scrollTop:0}, 100);	
//***********************************************
	return false;
}
function changeProductsSearch(productid)
{	
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	$('#webnemedia').hide();
	$("#dummydiv").slideUp("fast");	
	loadsearchproducts(productid);
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	return false;
}

function loadsearchproducts(productid)
{
	//$('html, body').animate({scrollTop: '0px'}, 800);
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	
//  $("#row1ss").innerHTML='';	
//	alert("callled");
	
	$("#detailsdiv").slideUp("slow");	
	$("#eventcatdiv").load(sPage+"?productid="+productid+"&show=productdetails&isajax=true");
	//$("#catmenudiv").load(sPage+"?catid="+catid+"&show=catmenu&isajax=true");
	$("#eventcatdiv").slideDown("slow");
	//getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");
}
function loadcategories(catid){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	
//  $("#row1ss").innerHTML='';	
//	alert("callled");
	
	$("#detailsdiv").slideUp("slow");	
	$("#eventcatdiv").load(sPage+"?catid="+catid+"&show=categories&isajax=true");
	$("#catmenudiv").load(sPage+"?catid="+catid+"&show=catmenu&isajax=true");
	$("#eventcatdiv").slideDown("slow");
	getpositions("eventcatdiv");
	//getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");
}

function loadcategories2(catid){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	//$("#detailsdiv").slideUp("slow");	
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	$("#eventcatdiv").load(sPage+"?catid="+catid+"&show=categories&isajax=true");
	$("#catmenudiv").load(sPage+"?catid="+catid+"&show=catmenu&isajax=true");
	$("#eventcatdiv").slideDown("slow");
	getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");
}

function loadcatpage(catid,page,eventid){
	//$('html, body').animate({scrollTop: '0px'}, 800);

	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	$('#detailsdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	$("#detailsdiv").slideUp("slow");	
	if(eventid>0){
		$("#eventcatdiv").load(sPage+"?catid="+catid+"&show=categories&isajax=true&page="+page+"&eventid="+eventid);	
		//alert(sPage+"?catid="+catid+"&show=categories&isajax=true&page="+page+"&eventid="+eventid);
	}else{
		$("#eventcatdiv").load(sPage+"?catid="+catid+"&show=categories&isajax=true&page="+page);			
	}
	$("#eventcatdiv").slideDown("slow");
	getpositions("eventcatdiv");
}
function loadcatpagealphabets(catid,alpha){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	$('#detailsdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	$("#detailsdiv").slideUp("slow");	
	$("#eventcatdiv").load(sPage+"?catid="+catid+"&show=categories&isajax=true&alpha="+alpha);	
	$("#eventcatdiv").slideDown("slow");
	getpositions("eventcatdiv");
}


function showbarcodedetails(barcodeid){
	//alert($('#detailsdiv').position().top)
	//alert('hello');
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	//$("#eventcatdiv").scrollTo( 0, 800, {queue:true} );
	//$('#scrollable').animate({scrollTop: '+=2px'}, 2, 'bounceout');
	
	//$("#eventcatdiv").slideUp("slow");
	//$('#detailsdiv').html('<p valign="center"><img src="/images/ajax-loader2.gif" width="220" height="19" /></p>');
	$('#detailsdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	$("#detailsdiv").load(sPage+"?barcodeid="+barcodeid+"&show=barcodedetails&isajax=true");
	$("#detailsdiv").slideDown("slow");
	//var top =$('#detailsdiv').position().top;
	//$('html, body').animate({scrollTop: top-10}, 800);
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
	//getpositions("detailsdiv");
	////////////////////////////////////////////////////////////////////////////////
	var  maskHeight= $(document).height();
	var maskWidth = $(window).width();	//$("#detailsdiv").style.position	="fixed";
	$("#detailsdiv").css({position:'fixed',backgroundColor:'#eee',width:'600px'});	
	
	$("#detailsdiv").css('left', (maskWidth/2)-(400 / 2));	
	//transition effect
	$("#detailsdiv").fadeIn(2000); 			
}
function goback(){

	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	$("#eventcatdiv").slideDown("slow");
	$("#detailsdiv").slideUp("slow");
	//getpositions("eventcatdiv");
	/*var top =$('#eventcatdiv').position().top;
	$('html, body').animate({scrollTop:0}, 100);*/	
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
		$('html, body').animate({scrollTop: '0px'}, 10);
}
function goback_barcode(){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	$("#eventcatdiv").slideDown("slow");
	$("#detailsdiv").slideUp("slow");
	getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
}

function show_entity_details(id){
	//alert($('#detailsdiv').position().top)
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	//$("#eventcatdiv").scrollTo( 0, 800, {queue:true} );
	//$('#scrollable').animate({scrollTop: '+=2px'}, 2, 'bounceout');
	//$("#eventcatdiv").slideUp("slow");
	//$('#detailsdiv').html('<p valign="center"><img src="/images/ajax-loader2.gif" width="220" height="19" /></p>');
	$('#detailsdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	$("#detailsdiv").load(sPage+"?id="+id+"&show=details&isajax=true");
	$("#detailsdiv").slideDown("slow");
	//var top =$('#detailsdiv').position().top;
	//$('html, body').animate({scrollTop: top-10}, 800);
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
	getpositions("detailsdiv");
}



function getpositions(divpos){
	var top =$('#'+divpos).position().top;
	//alert(top);
	$('html, body').animate({scrollTop: top-110}, 500);	
	
}

function loadbrandpage(brandid,page){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	$('#detailsdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');
	$("#detailsdiv").slideUp("slow");	
	$("#eventcatdiv").load(sPage+"?brandid="+brandid+"&show=branddetails&isajax=true&page="+page);
	
	$("#eventcatdiv").slideDown("slow");
	getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");
}
function showbranddetails(brandid){
	
	//$('html, body').animate({scrollTop: '0px'}, 800);
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	//$("#eventcatdiv").scrollTo( 0, 800, {queue:true} );
	//$('#scrollable').animate({scrollTop: '+=2px'}, 2, 'bounceout');
	
	//$("#eventcatdiv").slideUp("slow");
	$("#dummydiv").slideUp("slow");	
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');	
	$("#eventcatdiv").load(sPage+"?brandid="+brandid+"&show=branddetails&isajax=true");
	$("#eventcatdiv").slideDown("slow");
	$("#detailsdiv").slideUp("slow");
	//getpositions("eventcatdiv");
	var top =$('#eventcatdiv').position().top;
	
	$('html, body').animate({scrollTop:0}, 100);	
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
}

function showrecipedetails(recipeid){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	//$("#eventcatdiv").scrollTo( 0, 800, {queue:true} );
	//$('#scrollable').animate({scrollTop: '+=2px'}, 2, 'bounceout');
	
	//$("#eventcatdiv").slideUp("slow");
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');	
	$("#eventcatdiv").load(sPage+"?recipeid="+recipeid+"&show=recipedetails&isajax=true");
	$("#eventcatdiv").slideDown("slow");
	$("#detailsdiv").slideUp("slow");
	getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
}


function showeventdetails(eventid){
	//$('html, body').animate({scrollTop: '0px'}, 800);
	for(i=0;i<1000;i++){
		//do noting;
		a=a++;
	}
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	//$("#eventcatdiv").scrollTo( 0, 800, {queue:true} );
	//$('#scrollable').animate({scrollTop: '+=2px'}, 2, 'bounceout');
	
	//$("#eventcatdiv").slideUp("slow");
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');	
	$("#eventcatdiv").load(sPage+"?eventid="+eventid+"&show=eventdetails&isajax=true");
	$("#eventcatdiv").slideDown("slow");
	$("#detailsdiv").slideUp("slow");
	getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
}
function get_page_name(){
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}	
	return sPage;
}
function show_all(){
	var sPage;
	sPage=get_page_name();
	//$('#wait_div').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');	
	$("#show_all").load(sPage+"?show=show_all&isajax=true");
	$("#show_all").slideDown("slow");
	//$('#wait_div').slideUp("slow");
	//$("#detailsdiv").slideUp("slow");
	//getpositions("show_all");
	
}

function ajaxloader(){
	$('#eventcatdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');	
}

function ajaxLoad(divname,pageadd){
//	$('html, body').animate({scrollTop: '0px'}, 800);
//	for(i=0;i<1000;i++){
//		//do noting;
//		a=a++;
//	}
	
	$("#divname").slideDown("slow");
	$("#divname").load(pageadd);	
	alert(divname+","+pageadd);
	//return false;
	//$("#detailsdiv").slideUp("slow");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
}
function minimize(id)
{
	var disp	=	document.getElementById(id).style.display;
	if(disp=='' || disp=='block')
	{
		//document.getElementById(id).style.display	=	'none';
		$("#"+id).slideUp("slow");
		//alert($('img_'+id +" img").src );
		//$('img_'+id +" img").src = "images/plus.png" ;
		document.getElementById('img_'+id).innerHTML	=	'<img  style="outline:none; border:0px;" src="images/plus.png" />';		
		//("#image img").attr({src : imgSrc});
	}
	else
	{
		//document.getElementById(id).style.display	=	'block';
		$("#"+id).slideDown("slow");
		//alert($('img_'+id +" img").src );		
		//$('img_'+id +" img").src = "images/minus.png" ;
		document.getElementById('img_'+id).innerHTML	=	'<img  style="outline:none; border:0px;"  src="images/minus.png" />';
	}

}
function onlyminimize(id)
{
	var disp	=	document.getElementById(id).style.display;
	if(disp=='' || disp=='block')
	{
		//document.getElementById(id).style.display	=	'none';
		$("#"+id).slideUp("slow");
		//alert($('img_'+id +" img").src );
		//$('img_'+id +" img").src = "images/plus.png" ;
		document.getElementById('img_'+id).innerHTML	=	'<img  style="outline:none; border:0px;" src="images/plus.png" />';		
		//("#image img").attr({src : imgSrc});
	}
	

}
function displaydiv(divid){	
//alert(divid);			
	if(document.getElementById(divid).style.display==''){
		document.getElementById(divid).style.display='None';
		document.getElementById("img"+divid).src='images/iconSortdownblue.gif';
		document.getElementById("span"+divid).innerHTML='More';
	}else{
		document.getElementById(divid).style.display='';
		document.getElementById("img"+divid).src='images/iconSortupblue.gif';	
		document.getElementById("span"+divid).innerHTML='Fewer';							
	}
}

function deletespecialorderitem(itemid){
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	var answer = confirm("Are you sure want to delete item ?")
    if (answer){
		$('#waitdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');		
		$("#spitems").load(sPage+"?opt=del&isajax=true&itemid="+itemid);
		$("#spitems").slideDown("slow");
		$("#waitdiv").slideUp("slow");
		//getpositions("eventcatdiv");
		//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");	
	}
}

function updatespecialorderitem(itemid){
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if(sPage==''){
		sPage="index.php";
	}
	var QTY;
	QTY=($('#QTY'+itemid).val());
	$('#waitdiv').html('<div style="text-align:center; width:100%;"><img src="images/ajax-loader(2).gif"  /></div>');		
	$("#spitems").load(sPage+"?opt=update&isajax=true&qty="+QTY+"&itemid="+itemid);
	$("#spitems").slideDown("slow");
	$("#waitdiv").slideUp("slow");
	//getpositions("eventcatdiv");
	//$("#rightproducts").load(sPage+"?brandid="+id+"&show=rightproducts&isajax=true");		
}
/******************************************************************************/
function toggle(showHideDiv, switchTextDiv) {
	var ele = document.getElementById(showHideDiv);
	var text = document.getElementById(switchTextDiv);
	if(ele.style.display == "block") {
    	ele.style.display = "none";
		text.innerHTML = "[+]";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "[-]";
	}
}
