var PageID="";
var ID="";
var check="";
var ContactID="";
var CompanyName="";
var CustomerName="";
var Address="";
var City="";
var State="";
var Zipcode="";
var Phone="";
var Cell="";
var Fax="";
var EmailAddress="";
var Notes="";
var Submit="Submit";
var Product = "";
var Quantity="";
var Height="";
var Length="";
var Sides="";
var Logo="";
var Indoor="";
var Installed="";
var Mount="";
var Description="";
var Img1="";
var Img2="";
var Img3="";
var Img4="";
var Img5="";
var User="";
var Pass="";
function Submitform(form,check) {
PageID = document.myform.PageID.value;
ID = document.myform.ID.value;
if(check == null){
check = document.myform.check.value;
}
ContactID = document.myform.ContactID.value;
CustomerName = document.myform.CustomerName.value;
Phone = document.myform.Phone.value;
EmailAddress = document.myform.EmailAddress.value;
if (PageID == 2 || PageID == 3 || PageID == 18||PageID == 15||PageID == 13 ||PageID == 14){
Address = document.myform.Address.value;
CompanyName = document.myform.CompanyName.value;
City = document.myform.City.value;
State = document.myform.State.value;
Zipcode = document.myform.Zipcode.value;
}
if (PageID == 2 ||  PageID == 3 || PageID == '18'||PageID == '15'|| PageID == 13 ||PageID == 14){
Cell = document.myform.Cell.value;
Fax = document.myform.Fax.value;
if(ContactID == ''){
// do nothing
} else {
Notes = document.myform.Notes.value;
}
}
if (PageID == '18'|| PageID == 19 || PageID == 13 ||PageID == 14){
Notes = document.myform.Notes.value;
}
Submit = "Submit";
if (PageID == 15){
Product = document.myform.Product.value;
// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
function valSides(Sides) {
    var cnt = -1;
    for (var i=Sides.length-1; i > -1; i--) {
        if (Sides[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return Sides[cnt].value;
    else return null;
}   
function valLogo(Logo) {
    var cnt = -1;
    for (var i=Logo.length-1; i > -1; i--) {
        if (Logo[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return Logo[cnt].value;
    else return null;
}   
function valIndoor(Indoor) {
    var cnt = -1;
    for (var i=Indoor.length-1; i > -1; i--) {
        if (Indoor[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return Indoor[cnt].value;
    else return null;
}         
function valInstalled(Installed) {
    var cnt = -1;
    for (var i=Installed.length-1; i > -1; i--) {
        if (Installed[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return Installed[cnt].value;
    else return null;
} 
function valMount(Mount) {
    var cnt = -1;
    for (var i=Mount.length-1; i > -1; i--) {
        if (Mount[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return Mount[cnt].value;
    else return null;
} 
Quantity = document.myform.Quantity.value;
Height = document.myform.Height.value;
Length = document.myform.Length.value;
Sides = valSides(document.myform.Sides);
Logo = valLogo(document.myform.Logo);
Indoor = valIndoor(document.myform.Indoor);
Installed = valInstalled(document.myform.Installed);
Mount = valMount(document.myform.Mount);
Description = document.myform.Description.value;
Img1 = document.myform.Img1.value;
Img2 = document.myform.Img2.value;
Img3 = document.myform.Img3.value;
Img4 = document.myform.Img4.value;
Img5 = document.myform.Img5.value;
}
if (PageID == 2){
User = document.myform.User.value;
Pass = document.myform.Pass.value;
}
navigate(PageID,ID,check,ContactID,CompanyName,CustomerName,Address,City,State,Zipcode,Phone,Cell,Fax,EmailAddress,Notes,"Submit",Product,Quantity,Height,Length,Sides,Logo,Indoor,Installed,Mount,Description,Img1,Img2,Img3,Img4,Img5,User,Pass);
}
var req;
function navigate(PageID,ID,check,ContactID,CompanyName,CustomerName,Address,City,State,Zipcode,Phone,Cell,Fax,EmailAddress,Notes,Submit,Product,Quantity,Height,Length,Sides,Logo,Indoor,Installed,Mount,Description,Img1,Img2,Img3,Img4,Img5,User,Pass) {
		var url = "./admin/includes/ajaxcms.php?PageID="+PageID+"&ID="+ID+"&check="+check+"&ContactID="+ContactID+"&CompanyName="+CompanyName+"&CustomerName="+CustomerName+"&Address="+Address+"&City="+City+"&State="+State+"&Zipcode="+Zipcode+"&Phone="+Phone+"&Cell="+Cell+"&Fax="+Fax+"&EmailAddress="+EmailAddress+"&Notes="+Notes+"&submit="+Submit+"&Product="+Product+"&Quantity="+Quantity+"&Height="+Height+"&Length="+Length+"&Sides="+Sides+"&Logo="+Logo+"&Indoor="+Indoor+"&Installed="+Installed+"&Mount="+Mount+"&Description="+Description+"&Img1="+Img1+"&Img2="+Img2+"&Img3="+Img3+"&Img4="+Img4+"&Img5="+Img5+"&User="+User+"&Pass="+Pass;
        if(window.XMLHttpRequest) {
                req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
                req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        req.open("GET", url, true);
        req.onreadystatechange = callback;
        req.send(null);
}

function callback() {        
        obj = document.getElementById("navigate");
       
		if(req.readyState == 4) {
                if(req.status == 200) {
                        response = req.responseText;
                        obj.innerHTML = response;
						initLightbox();
                } else {
                        alert("There was a problem retrieving the data:\n" + req.statusText);
                }
	}
	}
