$(document).ready(function () {

	//dev 
	
	//var urlCartServer = "http://localhost:53966/aspx/";
	//var urlCheckoutServer = "http://localhost:61837/secure/";	
	var urlCartServer = "http://cart.mylabcoats.com/";	
	var urlCheckoutServer = "https://secure.computercompany.net/mylabcoats/";	

    $('.emailRetrievalInput').each(function () {

        $(this).watermark("Enter your email...", "watermark");
    });

     $('#btnAddToAutomail').click(function (event) {
        event.preventDefault();
        
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; 
		var emailaddressVal = $('#txtAddToAutomailEmail').val();
		if(emailaddressVal == '') 
		{            
			alert('Please enter your email address.');            
			        
		}         
		else if(!emailReg.test(emailaddressVal)) 
		{   alert('Enter a valid email address.');            
			
		}  
        else {
            var strEmailAddress =  $('#txtAddToAutomailEmail').val() ;
			window.location.replace(urlCartServer + "emailRetrieval.aspx?EmailAddress=" + strEmailAddress);
            
        }

    });
 


    $('[id=lnkBookmark]').click(function (event) {
        event.preventDefault();

        var bookmarkUrl = (this).href;

        var bookmarkTitle = (this).title;
        (this).href = "#";
        if (window.sidebar) { // For Mozilla Firefox Bookmark

            window.sidebar.addPanel(bookmarkTitle, bookmarkUrl, "");

        } else if (window.external || document.all) { // For IE Favorite

            try {
                window.external.AddFavorite(bookmarkUrl, bookmarkTitle);
            } catch (e) {

                alert('Your browser does not support this bookmark action');
            }

        } else if (window.opera) { // For Opera Browsers

            $("a.jQueryBookmark").attr("href", bookmarkUrl);
            $("a.jQueryBookmark").attr("title", bookmarkTitle);
            $("a.jQueryBookmark").attr("rel", "sidebar");

        } else { // for other browsers which does not support
            alert('Your browser does not support this bookmark action');
            return false;
        }

        return false;
    });

	viewCart
//	$.getJSON("http://mylabcoats2.tccbeta.com/General.asmx/GetCartCount?callback=?", function(json) { alert(json);});
	
//	$.ajax({
//		type: "GET",
//        contentType: "application/json; charset=utf-8",
//        url: "http://mylabcoats2.tccbeta.com/General.asmx/GetCartCount",
//        data: "{}",
//        dataType: "jsonp",
//  success: function(result){
    //alert("token recieved: " + result.count);
  //},
  //error: function(request, textStatus, errorThrown) {
//	alert(request.responseText);
//    alert(errorThrown + "1");
//  },
//  complete: function(request, textStatus) { //for additional info
//    alert(request.responseText); 
    //alert(textStatus);
  //}
//});

	
	$("[href='ShoppingCart.aspx']").each(function(){ 
	var href = $(this).attr('href').replace('ShoppingCart.aspx', urlCartServer + 'ShoppingCart.aspx'); 
   $(this).attr("href", href); 
	});
   
$("[href='login.aspx']").each(function(){ 
	var href = $(this).attr('href').replace('login.aspx', urlCheckoutServer + 'login.aspx'); 
   $(this).attr("href", href); 
	});


});




