﻿var loaded = 0;
var baseURL = "http://www.perfectfry.com/";
var URL = window.location.href.toLowerCase();
var visitedCompetitor = 0;
var contactdomain = "perfectfry.com";
var contact = "";

var competitors = new Array();
competitors[0] = 'http://www.autofry.com';
competitors[1] = 'http://autofry.com';
competitors[2] = 'http://www.broaster.com';
competitors[3] = 'http://broaster.com';
var visitedPlaces = new Array();   
var visitedLink = '#000000';  




function PreLoad()
{
	
if (document.images != null)
	{
	
clickme1 = new Image();
clickme1.src = baseURL + "images/menu/products.gif";
clickme1o = new Image();
clickme1o.src = baseURL + "images/menu/products-o.gif";

clickme2 = new Image();
clickme2.src = baseURL + "images/menu/service.gif";
clickme2o = new Image();
clickme2o.src = baseURL + "images/menu/service-o.gif";

clickme3 = new Image();
clickme3.src = baseURL + "images/menu/distributors.gif";
clickme3o = new Image();
clickme3o.src = baseURL + "images/menu/distributors-o.gif";

clickme3n = new Image();
clickme3n.src = baseURL + "images/menu/news-events.gif";
clickme3no = new Image();
clickme3no.src = baseURL + "images/menu/news-events-o.gif";

clickme4 = new Image();
clickme4.src = baseURL + "images/menu/about.gif";
clickme4o = new Image();
clickme4o.src = baseURL + "images/menu/about-o.gif";

clickme5 = new Image();
clickme5.src = baseURL + "images/menu/contact.gif";
clickme5o = new Image();
clickme5o.src = baseURL + "images/menu/contact-o.gif";

clickme6 = new Image();
clickme6.src = baseURL + "images/menu/home.gif";
clickme6o = new Image();
clickme6o.src = baseURL + "images/menu/home-o.gif";

}
	loaded = 1;
}
function hiLite(imgDocID,imgObjName) {
if (document.images !=null)
{
if (loaded)
document.images[imgDocID].src = eval(imgObjName + ".src")
}
}

        var timerID = null;
		var timerOn = false;
		var timecount = 0;
		var what = null;
		var newbrowser = true;
		var check = false;

    	function init(){
    	//  alert ("Running Init");
          if (document.layers) {
                      //  alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                      //  alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                      //  alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
		//window.status='status bar text to go here';
		check = true;
  	 	}
	// Turns the layers on and off
        function showLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}

        function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }

		function hideAll(){
				hideLayer('seekers');
				//hideLayer('employers');
		}
		
		function startTime() {
	        if (timerOn == false) {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;
	        }
		}

		function stopTime() {
	        if (timerOn) {
		        clearTimeout(timerID);
	            timerID = null;
	            timerOn = false;
	        }
		}

function bookmark(page,title) {
 window.external.AddFavorite(page, title)
}

function externalLinks() { 

if (!document.getElementsByTagName) return; 

var anchors = document.getElementsByTagName("a"); 
for (var i=0; i<anchors.length; i++) { 
var anchor = anchors[i]; 
var relvalue = anchor.getAttribute("rel");

if (anchor.getAttribute("href")) {
var external = /external/;
var relvalue = anchor.getAttribute("rel");
if (external.test(relvalue)) { anchor.target = "_blank"; }
} 
}
} 

function createcontact(alias,sitedomain){
contactlink = '<a href="mailto:' + alias + '@' + sitedomain + '">';
contactlink = contactlink + alias + "@" + sitedomain;
contactlink = contactlink + '</a>';
}

function getQueryVariable(variable) { 
  var query = window.location.search.substring(1); 
  var vars = query.split("&"); 
  for (var i=0;i<vars.length;i++) { 
    var pair = vars[i].split("="); 
    if (pair[0] == variable) { 
      return pair[1]; 
    } 
  } 

}  

function writeHeader()
{
var pagename_array = URL.split("/");
var barefile_array = pagename_array[3].split(".");
var result = barefile_array[0];
if(result==""){
result = "index";
}
//competitor visited test
if(visitedCompetitor == 0){

switch(result)
{
case "index":
    header='<img src="/images/headers/testimonial-prefect1.jpg" width="960" height="280" alt="Its the quickest and simplest way to cook fried foods.  It truly is the PERFECT FRYER" />';
    flashfile = "/swf/index-feb-2010.swf";
    doflashheader=1
   break;
//case "index":
 //   header='<img src="/images/headers/testimonial-prefect1.jpg" width="960" height="280" alt="Its the quickest and simplest way to cook fried foods.  It truly is the PERFECT FRYER" />';
//    flashfile = "/swf/no-vent-required.swf";
//    doflashheader=1
//   break;
case "index3":
    //flashfile = "/swf/2a.swf";
    doflashheader=0
    header='<img src="/images/headers/testimonial-prefect1.jpg" width="960" height="280" alt="Its the quickest and simplest way to cook fried foods.  It truly is the PERFECT FRYER" />';
    break;
case "contact":
case "contactconfirm":
    header='<img src="/images/headers/just-ask.jpg" width="960" height="280" alt="Just Ask" />';
    doflashheader=0
    break; 
case "servicesupport":
    barefile_array = pagename_array[4].split(".");
    result = barefile_array[0];
        //test sub pages
        switch(result)
        {
        case "profitstory":
            header='<img src="/images/headers/testimonial-drinks.jpg" width="960" height="280" alt="" />';
           flashfile = "/swf/gravy-flash-1.swf";
            doflashheader=1
            break;
        case "faq":
            doflashheader=0;
            header='<img src="/images/headers/testimonial-buffet.jpg" width="960" height="280" alt="" />';
            break;
        case "warrantyregistration":
            doflashheader=0;
            header='<img src="/images/headers/testimonial-trucks.jpg" width="960" height="280" alt="" />';
            break;
       case "knowledgebase":
            doflashheader=0;
            header='<img src="/images/headers/testimonial-calgary.jpg" width="960" height="280" alt="" />';
            break;
        default:
            doflashheader=0;
            header='<img src="/images/headers/live-the-american-dream.jpg" width="960" height="280" alt="" />';
            break;
        }
    break; 
case "products":
    barefile_array = pagename_array[4].split(".");
    result = barefile_array[0];
    doflashheader=0
    //test sub pages
    switch(result)
        {
        case "pfc":
            header='<img src="/images/headers/pfc-1.jpg" width="960" height="280" alt="" />';
            break;
        case "pfa":
            header='<img src="/images/headers/food-in-money-out.jpg" width="960" height="280" alt="" />';
            break;
        case "pfm":
            header='<img src="/images/headers/pfm-header-2.jpg" width="960" height="280" alt="" />';
            break;
        case "accessories":
            header='<img src="/images/headers/parts-1.jpg" width="960" height="280" alt="" />';
            break;
        case "testimonials":
            header='<img src="/images/headers/testimonial-drinks.jpg" width="960" height="280" alt="" />';
            break;
        case "solutions":
            header='<img src="/images/headers/perfect-fry-or-other-guy.jpg" width="960" height="280" alt="" />';
            flashfile = "/swf/pfc-solution-11-2.swf";
            doflashheader=1
        case "spinfresh":
            header='<img src="/images/headers/spin-fresh-2.jpg" width="960" height="280" alt="" />';
            flashfile = "/swf/pfc-solution-11-2.swf";
            doflashheader=0
     break;
        default:
            header='<img src="/images/headers/live-the-american-dream.jpg" width="960" height="280" alt="" />';
            break;
        }
    break;   
case "about": 
    barefile_array = pagename_array[4].split(".");
    result = barefile_array[0];
    doflashheader=0
    //test sub pages
    switch(result)
    {
        case "missionstatement":
            header='<img src="/images/headers/testimonial-gas.jpg" width="960" height="280" alt="" />';
            doflashheader=0
            break;
        case "history":
            header='<img src="/images/headers/testimonials-50s-diner.jpg" width="960" height="280" alt="" />';
            doflashheader=0
            break;
        case "awards":
            header='<img src="/images/headers/awards.jpg" width="960" height="280" alt="" />';
            doflashheader=0
            break;
        case "companyinfo":
            header='<img src="/images/headers/testimonials-50s-diner.jpg" width="960" height="280" alt="" />';
            doflashheader=0
            break;
        default:
            header='<img src="/images/headers/testimonial-calgary.jpg" width="960" height="280" alt="" />';
            break;
     }    
    break;
case "news":     
    header='<img src="/images/headers/testimonial-costs-half.jpg" width="960" height="280" alt="Make fries from heaven!" />';
    doflashheader=0
    break;
case "events":     
    header='<img src="/images/headers/fries-from-heaven2.jpg" width="960" height="280" alt="Make fries from heaven!" />';
    doflashheader=0
    break;
default:
    header='<img src="/images/headers/perfect-fry-or-other-guy.jpg" width="960" height="280" alt="" />';
    flashfile = "/swf/2a.swf";
   break;
}
}else{
    header='<img src="/images/headers/perfect-fry-or-other-guy.jpg" width="960" height="280" alt="" />';
    doflashheader=1;
    flashfile = "/swf/2a.swf";

}

}



//here you place the ids of every element you want.
var ids=new Array('a','b','c','d','e','f','g','h','i','j');
var ids2=new Array('a','b','c','d');
var programs=new Array('a','b');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function switchid2(id){	
	hideallids2();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hideallids2(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids2.length;i++){
		hidediv(ids2[i]);
	}		  
}

function switchprogram(id){	
	hideallprograms();
	showdiv(id);
}

function hideallprograms(){
	//loop through the array and hide each element by id
	for (var i=0;i<programs.length;i++){
		hidediv(programs[i]);
	}		  
}


function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { 
	obj=obj.style; 
	t=(v=='show')?'visible':(v=='hide')?'hidden':v;
	z=(v=='show')?'block':(v=='hide')?'none':v;
	}
	
	obj.visibility=t;
    obj.display=z;
	
	}
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=645,height=485,left = 360.5,top = 141.5');");
}