﻿String.prototype.trim = function()
{
    return this.replace(/(^\s+)|(\s+$)/g, ""); 
}

EmptyGUID = "00000000-0000-0000-0000-000000000000"




$(function() {

    $("#postUploadform").click(function(e) {
        document.frmCreateYourOwnLamp.submit();
    });
});   

function redirectTo(to) {
    //debugger
    window.location = to
}

function getFileNameFromUrl(data) {
    return data.match(/(.*)[\/\\]([^\/\\]+)\.\w+$/)[2];
}

function isHtmlBodyValid(value) {
    var scriptsRegExp = /(<[ ]*[sS][cC][rR][iI][pP][tT])|(<[a-zA-Z ][^>]*\s[oO][nN][\w ]+=([\w+ ]|'[^']*'|"[^"]*")[^>]*>)|([hH][rR][eE][fF][ ]*=['" ]*[jJ][aA][vV][aA][sS][cC][rR][iI][pP][tT][ ]*:)/;
    return value.match(scriptsRegExp) == null;    
}

$(function(){
    function topMenuDropDown(){
	 	this.showDropDown = function(jElemTriger){
			if(jElemTriger.is(":hidden"))
				jElemTriger.show();
		 }
		this.closeDropDown = function(jElemTriger){
				jElemTriger.hide();
			}
	}
	var dropDownObj = new topMenuDropDown();
	$("#dropTrig1, #dropTrig2, #dropTrig3").mouseover(function(e) {
			var elm = $(this).contents().filter(".subItemsBox");
			dropDownObj.showDropDown(elm);
			}).mouseout(function(){
				var elm1 = $(this).contents().filter(".subItemsBox");
				dropDownObj.closeDropDown(elm1);
				});
});
$(function () {
    $(document).ajaxError(function (ev, request) {        
        if (request.status == 403 && request.statusText == "SESSIONTIMEOUT") {
            window.location = "/Home/SessionTimeout";
        }
    });
    $("div.scrollable").scrollable();
});


                             



