over_30.setLabel("age over 30");
under_30.setLabel("age under 30");
blond.setLabel("blond");
black.setLabel("black");
nameBut.enabled = false;
InstanceName_0.backgroundColor = 0xFEFFD9;
myList.setStyleProperty("shadow", 0x000000);
myList.setSize(150, 100);
myList.setStyleProperty("background", 0xFEFFD9);
function searchSite() {
myList.removeAll();
headline = "";
InstanceName_0.text = "";
nameBut.enabled = false;
if (group1.getValue()=="age under 30") {
findModelsUnder30();
} else if (group1.getValue()=="age over 30") {
findModelsOver30();
}
}
function findModelsUnder30(){
models = new XML();
models.load("models.xml");
models.ignoreWhite = true;
models.onLoad = findModels;
findModels();
}
function findModelsOver30(){
models = new XML();
models.load("models1.xml");
models.ignoreWhite = true;
models.onLoad = findModels;
findModels();
}
//here we define our basic functions, which are used to parse different xml files
//for more details check earlier versions
function findModels() {
for (var count01=0; count01<= models.childNodes.length; count01++) {
if (this.childNodes[count01].nodeName.toLowerCase() == "models") {
var myModel01 = this.childNodes[count01];
}
}
findFemaleModels(myModel01);
}
function findFemaleModels(femaleModel) {
for (var count02=0; count02<=femaleModel.childNodes.length; count02++) {
if (femaleModel.childNodes[count02].nodeName.toLowerCase() == "female") {
var myModel02 = femaleModel.childNodes[count02];
}
}
findHairColor(myModel02);
}
function findHairColor(coloured) {
for (var count03=0; count03<=coloured.childNodes.length; count03++) {
if (coloured.childNodes[count03].nodeName.toLowerCase() == "haircolor") {
myModel03 = coloured.childNodes[count03];
colorHair = myModel03.attributes.hair;
//here we split our search using radiobuttons
if (group2.getValue()=="blond") {
if(colorhair == "blond"){
if (check1.getValue() == true){
findSubgroup_1 (myModel03);
}else if (check1.getValue() == false){
findSubgroup_2 (myModel03);
}
}
}
else if (group2.getValue()=="black") {
if(colorhair == "black"){
if (check1.getValue() == true){
findSubgroup_1 (myModel03);
}else if (check1.getValue() == false){
findSubgroup_2 (myModel03);
}
}
}
}
}
}
function findSubgroup_1 (subGroup) {
for (var count04=0; count04 <= subGroup.childNodes.length; count04++) {
myModel04 = subGroup.childNodes[count04];
//we start counting at 0, only the nodes with a positive match will be listed.
//all others even called here will be ignored. I have not yet succeeded to
//write a shortcut for this code. All shortcuts failed.
if(count04==0 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
modelName_0 = myModel04.attributes.name;
modelDescription_0 = myModel04.firstChild.nodeValue;
urlText_0 = myModel04.attributes.myUrl;
frame_0 = myModel04.attributes.myFrame;
chooseModel(modelName_0,modelDescription_0);
}
if(count04==1 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
modelName_1 = myModel04.attributes.name;
modelDescription_1 = myModel04.firstChild.nodeValue;
urlText_1 = myModel04.attributes.myUrl;
frame_1 = myModel04.attributes.myFrame;
chooseModel(modelName_1,modelDescription_1);
}
if(count04==2 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
modelName_2 = myModel04.attributes.name;
modelDescription_2 =myModel04.firstChild.nodeValue;
urlText_2 =myModel04.attributes.myUrl;
frame_2 = myModel04.attributes.myFrame;
chooseModel(modelName_2,modelDescription_2);
}
if(count04==3 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
modelName_3 = myModel04.attributes.name;
modelDescription_3 = myModel04.firstChild.nodeValue;
urlText_3 = myModel04.attributes.myUrl;
frame_3 = myModel04.attributes.myFrame;
chooseModel(modelName_3,modelDescription_3);
passVar(urlText_3,modelName_3,frame_3);
}
if(count04==4 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
modelName_4 = myModel04.attributes.name;
modelDescription_4 = myModel04.firstChild.nodeValue;
urlText_4 = myModel04.attributes.myUrl;
frame_4 = myModel04.attributes.myFrame;
chooseModel(modelName_4,modelDescription_4);
}
if(count04==5 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
modelName_5 = myModel04.attributes.name;
modelDescription_5 = myModel04.firstChild.nodeValue;
urlText_5 = myModel04.attributes.myUrl;
frame_5 = myModel04.attributes.myFrame;
chooseModel(modelName_5,modelDescription_5);
}
}
}
//this is to find option 1, we access all the childnodes of haircolor
function findSubgroup_2 (subGroup) {
for (var count05=0; count05 <= subGroup.childNodes.length; count05++) {
myModel05 = subGroup.childNodes[count05];
//we start counting at 0, only the nodes with a positive match will be listed.
//all others even called here will be ignored. I have not yet succeeded to
//write a shortcut for this code. All shortcuts failed.
if(count05==0 && myModel05 != undefined){
modelName_0 = myModel05.attributes.name;
modelDescription_0 = mymodel05.firstChild.nodeValue;
urlText_0 = mymodel05.attributes.myUrl;
frame_0 = mymodel05.attributes.myFrame;
chooseModel(modelName_0,modelDescription_0);
}
if(count05==1 && mymodel05 != undefined){
modelName_1 = mymodel05.attributes.name;
modelDescription_1 = mymodel05.firstChild.nodeValue;
urlText_1 = mymodel05.attributes.myUrl;
frame_1 = mymodel05.attributes.myFrame;
chooseModel(modelName_1,modelDescription_1);
}
if(count05==2 && mymodel05 != undefined){
modelName_2 = mymodel05.attributes.name;
modelDescription_2 =mymodel05.firstChild.nodeValue;
urlText_2 =mymodel05.attributes.myUrl;
frame_2 = mymodel05.attributes.myFrame;
chooseModel(modelName_2,modelDescription_2);
}
if(count05==3 && mymodel05 != undefined){
modelName_3 = mymodel05.attributes.name;
modelDescription_3 = mymodel05.firstChild.nodeValue;
urlText_3 = mymodel05.attributes.myUrl;
frame_3 = mymodel05.attributes.myFrame;
chooseModel(modelName_3,modelDescription_3);
}
if(count05==4 && mymodel05 != undefined){
modelName_4 = mymodel05.attributes.name;
modelDescription_4 = mymodel05.firstChild.nodeValue;
urlText_4 = mymodel05.attributes.myUrl;
frame_4 = mymodel05.attributes.myFrame;
chooseModel(modelName_4,modelDescription_4);
}
if(count05==5 && mymodel05 != undefined){
modelName_5 = mymodel05.attributes.name;
modelDescription_5 = mymodel05.firstChild.nodeValue;
urlText_5 = mymodel05.attributes.myUrl;
frame_5 = mymodel05.attributes.myFrame;
chooseModel(modelName_5,modelDescription_5);
}
if(count05==6 && myModel05 != undefined){
modelName_6 = myModel05.attributes.name;
modelDescription_6 = myModel05.firstChild.nodeValue;
urlText_6 = myModel05.attributes.myUrl;
frame_6 = myModel05.attributes.myFrame;
chooseModel(modelName_6,modelDescription_6);
}
if(count05==7 && myModel05 != undefined){
modelName_7 = myModel05.attributes.name;
modelDescription_7 = myModel05.firstChild.nodeValue;
urlText_7 = myModel05.attributes.myUrl;
frame_7 = myModel05.attributes.myFrame;
chooseModel(modelName_7,modelDescription_7);
}
if(count05==8 && myModel05 != undefined){
modelName_8 = myModel05.attributes.name;
modelDescription_8 = myModel05.firstChild.nodeValue;
urlText_8 = myModel05.attributes.myUrl;
frame_8 = myModel05.attributes.myFrame;
chooseModel(modelName_8,modelDescription_8);
}
if(count05==9 && myModel05 != undefined){
modelName_9 = myModel05.attributes.name;
modelDescription_9 = myModel05.firstChild.nodeValue;
urlText_9 = myModel05.attributes.myUrl;
frame_9 = myModel05.attributes.myFrame;
chooseModel(modelName_9,modelDescription_9);
}
if(count05==10 && myModel05 != undefined){
modelName_10 = myModel05.attributes.name;
modelDescription_10 = myModel05.firstChild.nodeValue;
urlText_10 = myModel05.attributes.myUrl;
frame_10 = myModel05.attributes.myFrame;
chooseModel(modelName_10,modelDescription_10);
}
}
}
function subMenu(myCount){
myModelname = eval("modelName_" +myCount);
thisUrl = eval("urlText_" +myCount);
myFrame = eval("frame_" +myCount);
nameBut.enabled = true;
trace(myFrame);
headline = "Press here for "+myModelname+"'s site."
}
//listbox function and function to define the url and model name
function chooseMenu(myList) {
InstanceName_0.text = myList.getValue();
if (myList.getValue()==modelDescription_0 && myList.getValue()!=undefined){
subMenu(0);
}
if (myList.getValue()==modelDescription_1 && myList.getValue()!=undefined){
subMenu(1);
}
if (myList.getValue()==modelDescription_2 && myList.getValue()!=undefined){
subMenu(2);
}
if (myList.getValue()==modelDescription_3 && myList.getValue()!=undefined){
subMenu(3);
}
if (myList.getValue()==modelDescription_4 && myList.getValue()!=undefined){
subMenu(4);
}
if (myList.getValue()==modelDescription_5 && myList.getValue()!=undefined){
subMenu(5);
}
if (myList.getValue()==modelDescription_6 && myList.getValue()!=undefined){
subMenu(6);
}
if (myList.getValue()==modelDescription_7 && myList.getValue()!=undefined){
subMenu(7);
}
if (myList.getValue()==modelDescription_8 && myList.getValue()!=undefined){
subMenu(8);
}
if (myList.getValue()==modelDescription_9 && myList.getValue()!=undefined){
subMenu(9);
}
if (myList.getValue()==modelDescription_10 && myList.getValue()!=undefined){
subMenu(10);
}
}
//function for the listbox
function chooseModel(model,description){
chooseMenu(myList);
myList.addItem(model,description);
myList.setChangeHandler("chooseMenu");
}
//function for the invisible button
function myUrl(buttonUrl,goFrame){
buttonUrl = thisUrl;
goFrame = myFrame;
if (goFrame == undefined && goFrame != "0"){
getURL(buttonUrl,"_blank");
}else if (goFrame!="0"){
gotoAndPlay(goFrame);
}else if (goFrame == "0"){
headline = "No site available.";
}
}
|