var popUpsBlocked=true;

function addToFavorites(url, name) {
    if (window.external) window.external.AddFavorite(url, name);
    else alert("Sorry! Your browser doesn't support this function. Please remember to manually add "+url+" to your favorites.");
}

function openWholesale() {
    window.open('http://www.bcay.com/BCAY/BCAYwholesale.html', 'BCAYwholesale', 'width=900, height=750');
}

function safeWholesale() {
    if (popUpsBlocked) document.write("<a class='tf_popup' href='http://www.bcay.com/BCAY/BCAYwholesale.html'>");
    else               document.write("<a class='tf_popup' href='#' onClick='javascript:openWholesale()'>");
    document.write("Dealer Login</a>\n");
}

function openVIP() {
    window.open('http://www.bcay.com/BCAY/BCAYvip.html', 'BCAYvip', 'width=800, height=650');
}

function safeVIP() {
    if (popUpsBlocked) document.write("<a style='FONT-SIZE: 12px; FONT-WEIGHT: bold; COLOR: #fff; FONT-FAMILY: sans-serif; TEXT-DECORATION: none' href='http://www.bcay.com/BCAY/BCAYvip.html'>");
    else               document.write("<a style='FONT-SIZE: 12px; FONT-WEIGHT: bold; COLOR: #fff; FONT-FAMILY: sans-serif; TEXT-DECORATION: none' href='#' onClick='javascript:openVIP()'>");
    document.write("Join VIP Club</a>\n");
}
function openContact() {
    window.open('http://www.bcay.com/BCAY/BCAYcontact.html', 'BCAYcontact', 'width=800, height=600, scrollbars=1');
}

function safeContact() {
    if (popUpsBlocked) document.write("<a style='FONT-SIZE: 12px; FONT-WEIGHT: bold; COLOR: #fff; FONT-FAMILY: sans-serif; TEXT-DECORATION: none' href='http://www.bcay.com/BCAY/BCAYcontact.html'>");
    else               document.write("<a style='FONT-SIZE: 12px; FONT-WEIGHT: bold; COLOR: #fff; FONT-FAMILY: sans-serif; TEXT-DECORATION: none' href='#' onClick='javascript:openContact()'>");
    document.write("Contact</a>\n");
}
function openPolicies() {
    window.open('http://www.bcay.com/BCAY/BCAYpolicies.html', 'BCAYpolicies', 'width=800, height=600, scrollbars=1');
}

function safePolicies() {
    if (popUpsBlocked) document.write("<a style='FONT-SIZE: 12px; FONT-WEIGHT: bold; COLOR: #fff; FONT-FAMILY: sans-serif; TEXT-DECORATION: none' href=http://www.bcay.com/BCAY/BCAYpolicies.html'>");
    else               document.write("<a style='FONT-SIZE: 12px; FONT-WEIGHT: bold; COLOR: #fff; FONT-FAMILY: sans-serif; TEXT-DECORATION: none' href='#' onClick='javascript:openPolicies()'>");
    document.write("Policies</a>\n");
}

function Trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function lTrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rTrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

function PopupMsg(Title,Message) {
    config='toolbar=no,location=no,directories=no,status=no,menubar=no';
    config += ',scrollbars=no,resizable=no';
    config += ',width=300,height=150';
    pop = window.open ("","pop",config);
    pop.document.write('<script language="javascript">');
    pop.document.write('setTimeout(');
    pop.document.write('"self.close()');
    pop.document.write(';",3000)');
    pop.document.write('</');
    pop.document.write('script>');
    pop.document.write('<body bgcolor=#FFFFFF>');
    pop.document.write('<center><b><h2>'+Title+'</h2></b></center>');
    pop.document.write('<center><b><h3>'+Message+'</h3></b></center>');
    pop.document.write('<center><b><h5>This window will close automatically.</h6></b></center>');
}

function DetectPopupBlocker(Title,Message) {
   var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
   if(mine) var popUpsBlocked = false;
   else     var popUpsBlocked = true;
   mine.close();
}





