// JavaScript Document
////////////////////////////////////////functions of jquery for rename the menu and submneu///////////////////////////////
var url = document.location;

jQuery(function($) {
	$('#showDialog').click(function() {      
	    $.blockUI({ message: $('#question'), css: { width: '275px' }});
     });
    $('#yes').click(function() {
        // update the block message
        $.blockUI({ message: '<h1 style="background:#000000; color:#FFFFFF; font-size:14px;" >Logging Out...</h1>' });
        location.href="admin.php?option='lgf'";
    });
    $('#no').bind('click', $.unblockUI);
    // wire up all the demo code
    });
jQuery(function($) {	
	$('.popupclass').click(function() { 
	idVal=$(this).attr('id'); 
	db_id=idVal.substring(5);
	$('#menudbid').val(db_id);
    $.blockUI({ message: $('#renameForm') }); 
    
    $('#subb').click(function() {
        // update the block message
   // $.blockUI({ message: '<h1 style="background:#000000; color:#FFFFFF; font-size:14px;" >Renaming...</h1>' });    
	 });		
    }); 
    $('#cancel').bind('click', $.unblockUI);
}); 	
	jQuery(function($) {	
	$('.popupclasssubmenu').click(function() { 
	idVal=$(this).attr('id'); 
	db_id=idVal.substring(8);
	$('#submenudbid').val(db_id);
    $.blockUI({ message: $('#subrenameForm') }); 
    
    $('#subbsubmenu').click(function() {
        // update the block message
   // $.blockUI({ message: '<h1 style="background:#000000; color:#FFFFFF; font-size:14px;" >Renaming...</h1>' });    
	 });
		
    }); 
    $('#cancel').bind('click',$.unblockUI);
});
	
//////////////////////////////for editing the banner section height and width////////////////////
	jQuery(function($) {	
	$('.bannersection').click(function() { 
	idVal=$(this).attr('id'); 
	db_id=idVal.substring(5);
	$('#bannercontainerid').val(db_id);
    $.blockUI({ message: $('#editForm') });
    
    $('#subb').click(function() {
      });
		
    }); 
    $('#cancel').bind('click', $.unblockUI);
});  
	
///////////////////////////////////////start code for pop-up window for portfolio/////////
	jQuery(function($) {	
	
    $('.popup_portfolio').click(function() { 
	idVal=$(this).attr('id'); 
	db_id=idVal.substring(10);
	ajax_show_portfolio('../Ajs/show_portfolio.php?portfolio_id='+db_id);
    //alert( $('#popupForm').html());
     jQuery.blockUI({ css: { 
        border: 'none', 
        padding: '15px',
		width:   '60%', 
        top:     '10%', 
        left:    '20%',
		bgcolor:  '#00000',
		cursor : 'default'
    }, message:  $('#popupForm') }); 
	//$.blockUI({ message: $('#popupForm').html() }); 
   
    $('#subb').click(function() {
	//location.replace("index.php?function=portfolio");
    // update the block message
   // $.blockUI({ message: '<h1 style="background:#000000; color:#FFFFFF; font-size:14px;" >Renaming...</h1>' });    
	 });		
    }); 
    $('#cancel').bind('click', $.unblockUI);
});
	///End code for pop-up window for portfolio/////////

///////////////////////////////////for menu_manager.php//////////////////////////////////////////////////////////
function menuDelete(id) 
{ Check = confirm("Do you want to delete this menu?")
  if(Check == true) 
  location.href = "admin.php?function=menu_manager&menu_id="+id;
}

//function frm_sub_add_user() ///to submit the form using a href, not submit button for adding user////////////
//{ document.add_user_form.submit(); 
//}

function frm_sub_menu_mng() ///to submit the form using a href, not submit button////////////
{ document.menu_form.submit(); 
}
function change_lang_menu(id) //for selecting different language///////////
{ location.href="admin.php?function=menu_manager&&lang_id="+id; }
//////////////////////////////////////////////////for submenu.php//////////////////////////////////////////////////////////////
function change_lang_submenu(id,menucatid)
{ location.href="admin.php?function=submenu&&submenuedit_id="+id+"&&menucatid="+menucatid; }

function frm_sub_submenu_mng()
{ document.submenu_form.submit();  }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////for new_page.php //////////////////////////////////////////////////////////
function lang_check(id)
{
    document.getElementById('newpage_form').attributes['action'].value="admin.php?function=new_page&&site_language="+id;
	document.getElementById('newpage_form').submit();
    
}
function menu_check(id)
{ 
  document.getElementById('newpage_form').attributes['action'].value="admin.php?function=new_page&&menu_id="+id;  
  document.getElementById('newpage_form').submit();  
 // document.getElementById('newpage_form').setAttribute("action","admin.php?function=new_page&&menu_id="+id);
  //document.newpage_form.action="admin.php?function=new_page&&menu_id="+id;
 // document.getElementById('newpage_form').submit();
}
///////////////////////////////////////////////////////////////////////////////////////
///////for portfolio manager/////////////////////////////////////////////////////
function portfolioDelete(id) 
{ Check = confirm("Do you want to delete this Item?")
  if(Check == true) 
  location.href = "admin.php?function=portfolio_manager&portfolio_id="+id;
}

function portfolioDelete2(id) 
{ Check = confirm("Do you want to delete this Item?")
  if(Check == true) 
  location.href = "admin.php?function=portfolio_manager2&portfolio_id="+id;
}

function frm_portfolio() ///to submit the form using a href, not submit button////////////
{ document.portfolio_form.submit(); }



////////////////////////
function change_lang_portfolio(id) //for selecting different language///////////
{ location.href="admin.php?function=portfolio_manager&&lang_id="+id; }

function change_lang_portfolio2(id) //for selecting different language///////////
{ location.href="admin.php?function=portfolio_manager2&&lang_id="+id; }

////////////////////////////for CMS managemernt///////////////////////////////////////////
function frm_submit(id) //to submit form when language is changed in which update action shud not be performed
{
//alert(id);
location.href="admin.php?function=cms&&langchg=true&&site_language="+id;

/*if(document.getElementById('submenuedit_form').attributes['action'])
{
document.getElementById('submenuedit_form').attributes['action'].value="admin.php?function=cms&&langchg=true&&site_language="+id;
}
else 
document.getElementById('submenuedit_form').setAttribute("action","admin.php?function=cms&&langchg=true&&site_language="+id);

document.getElementById('submenuedit_form').submit(); */
}

////////////////////////////for menu cms managemernt///////////////////////////////////////////
function frm_submitmenu(id) //to submit form when language is changed in which update action shud not be performed
{
if(document.getElementById('menuedit_form').attributes['action'])
{
document.getElementById('menuedit_form').attributes['action'].value="admin.php?function=add_service&&langchg=true&&site_language="+id;
}
else 
document.getElementById('menuedit_form').setAttribute("action","admin.php?function=add_service&&langchg=true&&site_language="+id);

document.getElementById('menuedit_form').submit(); 
}


function show_div()//to show div for adcode or adbanner
{   
 if(document.getElementById('adimage').checked)
   { document.getElementById('adupload').style.display='block';
     document.getElementById('ad_code').style.display='none';
   }   
 if(document.getElementById('adcode').checked)
   { document.getElementById('adupload').style.display='none';
     document.getElementById('ad_code').style.display='block';
   }
}


