$currentUser_id = $vendor->id;
    }
}
if ($vendor_id == $currentUser_id) {
    $validToEdit = true;
} else {
    if ($isAdmin) {
        $validToEdit = true;
    }
}
if (!(is_numeric($vendor_id) && $vendor_id != "")) {
    $validToEdit = false;
}
$usingVendor = NULL;
if ($validToEdit) {
    $usingVendor = $vpc->getVendorByID($vendor_id);
    $mailToLink = 'mailto:vendorUpload@stlbridalpros.com?';
    $mailToLinkSubject = 'subject=uid:' . $usingVendor->id . ' dir:';
} else {
    header('Location: http://www.stlbridalpros.com/vendorLogin.php');
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,  user-scalable=no"/>
<title>Edit Vendor- St. Louis Bridal Professionals</title>
<script src="scripts/jquery/jquery-1.11.2.min.js"></script>
<script src="scripts/serialize.js"></script>
<script src="scripts/plupload-2.1.2/js/plupload.full.min.js"></script>
<title>St. Louis Bridal Professionals - Vendors</title>
<script src="scripts/jquery/jquery-1.11.2.min.js"></script>
<!--<script src="scripts/jquery/vendorContactFormScripts.js"></script>-->
<link href="html5reset-1.6.1.css" rel="stylesheet" type="text/css">
<link href="all.css" rel="stylesheet" type="text/css">
<!--<link href="desktop.css" media="screen and (min-width:900px)" rel="stylesheet" type="text/css">
<link href="tablet.css" media="screen and (min-width:400px) and (max-width:899px)" rel="stylesheet" type="text/css">
<link href="phone.css" media="screen and (max-width:399px)" rel="stylesheet" type="text/css"> -->
<link href="vendorLandingPage.css" rel="stylesheet" type="text/css">
<link href="vendorLandingPage_NavMenu.css" rel="stylesheet" type="text/css">
</head>

<body>
<?php 
$vpc = new vendorsClass('vendorList.xml');
$vendor = $vpc->getVendorByID($vendorID);
?>

<header>
	<div id="header_innerWrap">
        <div id="groupLogo">
            <a href="http://www.stlbridalpros.com?m=vendors"><img id="groupLogoImg" src="images/logo_black_523_450.gif"/></a>
        </div>
        <div id="vendorLogoHolder">
            <img id="vendorHeaderImage" src="<?php 
echo $vendor->logo;
?>
"/>
        </div>
    </div>
    
<?php

include_once 'vendorsClass.php';
$vC = new vendorsClass();
$vendor = $vC->getVendorByID($_REQUEST['id']);
/*echo "vendor\n";
	print_r($vendor);
	echo "\n*******\n";*/
echo json_encode($vendor->isAdmin());
     $isAdmin = $vendor->isAdmin();
     $currentUser_id = $vendor->id;
 }
 if ($vendorObj['id'] == $currentUser_id) {
     $validToEdit = true;
 } else {
     if ($isAdmin) {
         $validToEdit = true;
     }
 }
 if (!(is_numeric($vendorObj['id']) && $vendorObj['id'] != "")) {
     $validToEdit = false;
 }
 $usingVendor = NULL;
 if ($validToEdit) {
     $usingVendor = $vpc->getVendorByID($vendorObj['id']);
 }
 if (!is_null($usingVendor)) {
     /*if (isset($vendorObj['vendorType']))
     			$usingVendor->vendorType = $vendorObj['vendorType'];
     		if (isset($vendorObj['vendorMemberShipType']))
     			$usingVendor->vendorMemberShipType = $vendorObj['vendorMemberShipType'];*/
     $usingVendor->name = $vendorObj['name'];
     $usingVendor->email = $vendorObj['email'];
     $usingVendor->website = $vendorObj['website'];
     $usingVendor->address = $vendorObj['address'];
     $usingVendor->facebook = $vendorObj['facebook'];
     $usingVendor->showFacebook = $vendorObj['showFacebook'];
     $usingVendor->instagram = $vendorObj['instagram'];
     $usingVendor->showInstagram = $vendorObj['showInstagram'];
     $usingVendor->twitter = $vendorObj['twitter'];
    $username = "";
    $isAdmin = false;
    $vendor = NULL;
    $username = $_SESSION['username'];
    $vendor = $vpc->findVendorWithEmail($username);
    if (!is_null($vendor)) {
        $isAdmin = $vendor->isAdmin();
    }
}
if ($isAdmin) {
    include_once 'vendorsClass.php';
    include_once 'Mail.php';
    require_once '/home/dvaqpvvw/php/Mail/mime.php';
    $vC = new vendorsClass();
    $admins = $vC->getAdmins();
    $vendor = $vC->getVendorByID($_REQUEST['vendorID']);
    $crlf = "\r\n";
    $hdrs = array('From' => '*****@*****.**', 'Subject' => 'Welcome to St. Louis Bridal Professionals');
    $mime = new Mail_mime($crlf);
    $mime->addHTMLImage("images/stlbridalprosLogo_200x180.jpg", "image/jpeg");
    $logo_cid = $mime->_html_images[count($mime->_html_images) - 1]['cid'];
    $mime->addHTMLImage("images/adminLogin.gif", "image/gif");
    $loginButton_cid = $mime->_html_images[count($mime->_html_images) - 1]['cid'];
    $emailBody = "<p>Welcome to <b>St. Louis Bridal Professionals</b>!</p>";
    $emailBody .= "<p> A profile has been created for you, but you must fill in the information before your information will be made available on the website.</p>";
    $emailBody .= '<p><a href="http://www.stlbridalpros.com/vendorLogin.php">Click here login and finish your profile.</a></p>';
    $emailBody .= '<p>Keep your login details for reference:</p>';
    $emailBody .= '<p><b>Email: </b>' . $vendor->email . '</p>';
    $emailBody .= '<p><b>Password: </b>' . $vendor->password . '</p>';
    $emailBody .= '<p>You can login from the main website (<a href="http://www.stlbridalpros.com">www.stlbridalpros.com</a>) by clicking this image: <img id="loginButton" src="cid:' . $loginButton_cid . '"/> found at the bottom of the page.</p>';
    $emailBody .= '<br/><br/><p>We look forward to having you be a part of this group!</p>';