function createCookie(name,value,days){
    if (days>0){
        var date = new Date();
	date.setTime(date.getTime()+(days*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
    }else 
        var expires = "";	
	document.cookie = name+"="+value+expires+"; path=/";
}

function DeleteCookies() {
    var exp = new Date();
    exp.setTime (exp.getTime() - 1); // This cookie is history (changed -1 to make it previous time)
    /*document.cookie = "type=; expires=" + exp.toGMTString() + "; path = /" ;*/
    document.cookie = "lang=; expires=" + exp.toGMTString() + "; path = /" ;
}

function getCookies(){
    var currentUrl=location.href;
    currentUrl=currentUrl.substring(0,currentUrl.lastIndexOf('/'))+'/';
    //var type = getCookie('USER_TYPE');
    var lang = getCookie('USER_LANG');
    if(lang=='' ||lang==null){
    	lang='ar';
    }
    /*if(type!=''&& type!=null){
        if(type == "personal"){
        	location.href=currentUrl+lang+"/Personal/index.htm"; 
        }else if(type=="business"){
            location.href=currentUrl+lang+"/Business/index.htm";
        }
    }else{
        location.href=currentUrl+lang+"/Home/index.htm";
    } */
    location.href=currentUrl+lang+"/Home/index.htm";
}

//<!--Getting Cookie with a given name -->
function getCookie(name){
    var cname = name + "=";
    var dc = document.cookie;
    if (dc.length > 0) {
        begin = dc.indexOf(cname);
        if (begin != -1) {
            begin += cname.length;
            end = dc.indexOf(";", begin);
            if (end == -1) 
                end = dc.length;
            return unescape(dc.substring(begin, end));
        }
    }
    return "";
}   
