// JavaScript Document E:\myproducts_sites\strangers\js\save\presidential-d.js
if(!myApp)var myApp={};
alert('coco');
function goajaxhtmlcontentforapplication(demand,value,pass_sctappli){
alert('l:5 xxx abcde '+pass_sctappli);
////alert('save/presidential-d.js, goajaxhtmlcontentforapplication demand='+demand+' , value='+value);
var urlphp,urlhtml,div,datasform='demand='+demand+'&value='+value+'&',isform=false;
var file='updatepageapplication.php';
var divname='iframepopup0';
if(pass_sctappli){
isform=true;
alert('l:13 abcde '+pass_sctappli);
sctappli='../../../'+pass_sctappli[0];
divname=pass_sctappli[1];
////E:\myproducts_sites\labo\tabber\ow\french _presidential_election_2017\saveaverageapplication.php
if(demand=='saveaverage'){
file='saveaverageapplication.php';isform=false;////datasform+='demand='+demand+'&value='+value;
}
else
file='savedatapageapplication.php';
var pass=pass_sctappli;
/// alert(demand+'\n'+file+'\n'+value);
}
//===
urlphp = sctappli+file;
urlhtml = '';
div=$Prot(divname);
//===
/// datasform+=(datasform!=''?'&':'');
alert('l:30 abcde datasform='+datasform);
if(!isform){
if(div)div.innerHTML = '
'; ///'
Loading... '+'[' + 'bootajax' + ']<\/p>';
datasform+='ps='+ps+'&sctappli='+sctappli+'&jslang='+jslang+'&refdat='+refdat+'&dirr='+dirr+'&filehere='+filehere+'&conn='+conn;
}
else
datasform+=Form.serialize('form'+value);
//===
var myAjax = new Ajax.Updater(div, urlphp,
{
postBody: $H({'urlhtml': urlhtml,
//// 'demand': demand,
/// 'value': value,
'datasform':datasform
}).toQueryString(),
evalScripts: true,
onComplete : function(xhr){
var success=(xhr.status==200);
/// alert(demand+' - '+divname+' - '+success+' - '+xhr.responseText);
div= $Prot(divname);
var tag,skip=false,response=xhr.responseText,jsonResponse=JSON.parse(response);
/// alert(demand+' -\n '+divname+' -\n '+success+' -\n '+response);
/*
if(!skip&&success&&demand=='fsend'){
///alert(demand+' \n '+jsonResponse['return']); //c jsonResponse['return']='ok'
alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok'
}
*/
if(!skip&&success&&(demand=='ftest'||demand=='fsend')){
var total=0;
for(var j=0;j
/// o=$Prot('evalpersonality');if(o)o.innerHTML=updateaverage;
/// location.href = location.href; $_POST['updateaverage']
skip=true;
// 'collsarray'
// $Prot('resultpolitic').innerHTML=jsonResponse['politic']['average'];
/// alert(demand+' -\n '+jsonResponse['politic']['average']+' -\n '+divname+' -\n '+div.innerHTML); //c jsonResponse['return']='ok'
}
if(!skip&&success&&demand=='saveaverage'){
alert(demand+' \n 1 \n pass \n'+pass);
location.href = location.href;
skip=true;
}
/*
if(!skip&&success&&demand=='ulang'&&response[0]=='ret:'+demand){
location.href = location.href; //c reload sans demande de renvoie de données
}
*/
}
}
);
}//c function goajaxhtmlcontentforapplication(demand,value)
function getClickPosition(e){
alert('l:118 '+e);
var el=e.currentTarget;
var parentPosition = getPosition(el);
var xPosition = e.clientX - parentPosition.x; /// - (theThing.clientWidth / 2);
var yPosition = e.clientY - parentPosition.y; /// - (theThing.clientHeight / 2);
alert('l:122 '+xPosition);
var x=el.getAttributeNode("alt").value.split('/');
var width=parseInt(x[0]);
var allwidth=parseInt(el.style.width);
var index=parseInt(xPosition/width);
var label = document.querySelector("#inp"+el.id); ///contentContainer");
if(label&&xPosition1&&index<4){label.style.background='orange';label.style.color='blue';}
if(index>3&&index<6){label.style.background='green';label.style.color='white';}
if(index>5){label.style.background='#ddd';label.style.color='black';label.value='?';}
}
////alert(xPosition+' - '+parseInt(xPosition/width)); ///.style.width
return {
x: xPosition,
y: yPosition,
index:index
};
/// theThing.style.left = xPosition + "px";
/// theThing.style.top = yPosition + "px";
}
// Helper function to get an element\'s exact position
function getPosition(el) {
var xPos = 0;
var yPos = 0;
while (el) {
if (el.tagName == "BODY") {
// deal with browser quirks with body/window/document and page scroll
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
var yScroll = el.scrollTop || document.documentElement.scrollTop;
xPos += (el.offsetLeft - xScroll + el.clientLeft);
yPos += (el.offsetTop - yScroll + el.clientTop);
} else {
// for all other non-BODY elements
xPos += (el.offsetLeft - el.scrollLeft + el.clientLeft);
yPos += (el.offsetTop - el.scrollTop + el.clientTop);
}
el = el.offsetParent;
}
return {
x: xPos,
y: yPos
};
}
function initialize_multiple_select(selectname,select1,select2,titlelist2,options_list2,options_list3,announcestyle){
/* Script Double Select Dropdown List, from: coursesweb.net/javascript/ */
///var dbl_list=new Object(); // JS object that stores data for options
function set_choices_multiple_select(selectname,select){
//// var x=name.substring(0,3);
//// var slist2='list2'+x;var slist3='list3'+x;
alert('790 ici '+select);
var objchoice=document.getElementById('choice'+selectname);
if(objchoice)objchoice.innerHTML='';
var x=document.getElementById('list1cat');var i=x.selectedIndex;
objchoice.innerHTML+=x.options[i].value+'::';
//======
x=document.getElementById(slist2);i=x.selectedIndex;
objchoice.innerHTML+=x.options[i].value+'::';
//======
x=document.getElementById(slist3);i=x.selectedIndex;
objchoice.innerHTML+=x.options[i].value+'::';
//======
}
//if(myApp.dbl_list[selectname])return(true);
myApp.dbl_list[selectname]={}; ///new Object();
// HERE replace the value with the text you want to be displayed near Select
var txtsl2=titlelist2;
alert('193 ici selectname='+selectname);
/*
Property with options for the Seccond select list
The key in this object must be the same with the values of the options added in the first select
The values in the array associated to each key represent options of the seccond select
*/
////myApp.dbl_list['$i_selectname'].$i_select2 slist2={
///alert(options_list2);
//administration:impots-CAF,suppliers:employeur-health-bank,customers:announces,others:amis-family-loisirs-cadeaux
///options_list2
myApp.dbl_list[selectname][select2]={
"administration": ['impots', 'CAF'],
"suppliers": ['employeur', 'health', 'bank'],
"customers": ['announces'],
"others": ['amis', 'family', 'loisirs', 'cadeaux']
};
/*
Property with text-content associated with the options of the 2nd select list
The key in this object must be the same with the values (options) added in each Array in "slist2" above
The values of each key represent the content displayed after the user selects an option in 2nd dropdown list
*/
////alert(options_list3);
///impots:www.marplo.net/ajax/,CAF:www.marplo.net/jocuri/,employeur:coursesweb.net/php-mysql/,health:coursesweb.net/javascript/,bank:coursesweb.net/flash/,announces:coursesweb.net/php-mysql/,amis:coursesweb.net/php-mysql/,family:coursesweb.net/javascript/,loisirs:coursesweb.net/flash/
///options_list3
myApp.dbl_list[selectname].scontent={
"impots": 'www.marplo.net/ajax/',
"CAF": 'www.marplo.net/jocuri/',
"employeur": 'www.marplo.net/anime/',
"health": 'coursesweb.net/php-mysql/',
"bank": 'coursesweb.net/javascript/',
"announces": 'coursesweb.net/flash/',
"amis": 'coursesweb.net/flash/',
"family": 'coursesweb.net/flash/',
"loisirs": 'coursesweb.net/flash/',
"cadeaux": 'coursesweb.net/flash/'
};
/* From here no need to modify */
// function to get the dropdown list, or content
myApp.dbl_list[selectname].getSelect=function(slist, option) {
/// var itemcontent=document.getElementById('itemcontent');
////if(itemcontent)
//// itemcontent.innerHTML=''; // empty option-content
if(myApp.dbl_list[selectname][slist][option]) {
// if option from the last Select, add text-content, else, set dropdown list
if(slist == 'scontent')
{
///myDebug._alert(new Array('script)',776,'lefttabmenu0-c.php'));
alert(myApp.dbl_list[selectname][slist][option]);
var itemcontent=document.getElementById('itemcontent');
if(!itemcontent)return(false);
itemcontent.innerHTML=myApp.dbl_list[selectname][slist][option];
}
else if(slist == select2) {
var addata=''; //'';
for(var i=0; i'+myApp.dbl_list[selectname][slist][option][i]+'';
}
//// document.getElementById('slist2').innerHTML=txtsl2+' ';
document.getElementById(select2).innerHTML=txtsl2+' ';
}
}
else if(slist == select2) {
// empty the tag for 2nd select list
document.getElementById(select2).innerHTML='';
}
}
var o=document.getElementById(select1);
if(o){
o.selectedIndex=1;
myApp.dbl_list[selectname].getSelect(select2,o.value);
}
}