/*   
Application Name: Cekodok
Application URI: http://cekodok.com
Author: Bitter Coffee Studio
Author URI: http://www.bitter-coffee.com
Version: 1.0
.
This stylings (part of the whole application) is made exclusively for Cekodok.com. Any of this code here is free to be used as long as there are is violation of copyright
.
*/

// JavaScript Document
// for pagination of the nested divs

//submit form to search for the ads
function pageChange(page) {
	gotoPage = '/_getList.php?page='+page;
	if (is_default === true) gotoPage = '/_getList.php?page='+ page + '&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}

function pageDefaultChange(page) {
	gotoPage = '/ajax/_getDefaultList.php?page='+page;
	if (is_default === true) gotoPage = '/ajax/_getDefaultList.php?page='+ page + '&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}

function pageSearchFoodsChange(page) {
	gotoPage = '/ajax/_searchGetFoodsList.php?page='+page;
	if (is_default === true) gotoPage = '/ajax/_searchGetFoodsList.php?page='+ page + '&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
	var tmpReq = new Ajax.Updater('result_food', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('h-search-form').serialize(true)});
}

function pageSearchMealPlansChange(page) {
	gotoPage = '/ajax/_searchGetMealPlansList.php?page='+page;
	if (is_default === true) gotoPage = '/ajax/_searchGetMealPlansList.php?page='+ page + '&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
	var tmpReq = new Ajax.Updater('result_meal_plans', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('h-search-form').serialize(true)});
}

function pageSearchNewsChange(page) {
	gotoPage = '/ajax/_searchGetNewsList.php?page='+page;
	if (is_default === true) gotoPage = '/ajax/_searchGetNewsList.php?page='+ page + '&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
	var tmpReq = new Ajax.Updater('result_news', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('h-search-form').serialize(true)});
}

function pageSearchDietTipsChange(page) {
	gotoPage = '/ajax/_searchGetDietTipsList.php?page='+page;
	if (is_default === true) gotoPage = '/ajax/_searchGetDietTipsList.php?page='+ page + '&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
	var tmpReq = new Ajax.Updater('result_diet_tips', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('h-search-form').serialize(true)});
}

function pageCategoryChange(cat_id, page) {
	gotoPage = '/ajax/_getCategoryList.php?cat_id='+cat_id+'&page='+page;
	if (is_default === true) gotoPage = '/ajax/_getCategoryList.php?cat_id='+cat_id+'&page='+page+'&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
//	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true});
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}

function pageCountryChange(country_id, page) {
	gotoPage = '/ajax/_getCountryList.php?country_id='+country_id+'&page='+page;
	if (is_default === true) gotoPage = '/ajax/_getCountryList.php?country_id='+country_id+'&page='+page+'&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
//	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true});
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}

function pageBrandChange(brand_id, page) {
	gotoPage = '/ajax/_getBrandList.php?brand_id='+brand_id+'&page='+page;
	if (is_default === true) gotoPage = '/ajax/_getBrandList.php?brand_id='+brand_id+'&page='+page+'&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
//	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true});
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}

function pageActTypeChange(type_id, page) {
	gotoPage = '/ajax/_getActTypeList.php?type_id='+type_id+'&page='+page;
	if (is_default === true) gotoPage = '/ajax/_getActTypeList.php?type_id='+type_id+'&page='+page+'&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
//	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true});
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}

function pageActivitiesChange(page) {
	gotoPage = '/ajax/_getActivitiesList.php?page='+page;
	if (is_default === true) gotoPage = '/ajax/_getActivitiesList.php?page='+page+'&mode=default'; //untuk page yg load automatically (so that page 2 dia x screw up)
	
	$('loading').style.display='block';
//	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true});
	var tmpReq = new Ajax.Updater('result', gotoPage,{ method:'post',onComplete:function() { new Effect.Fade('loading');}, asynchronous:true, parameters: $('searchform').serialize(true)});
}
