/*
	function disabletext() {
		return false
	}
	function reEnable(){
		return true
	}
//if the browser is IE4+
	document.onselectstart=new Function ("return false")
//if the browser is NS6
	if (window.sidebar || document.layer){
	document.onmousedown=disabletext
	document.onclick=reEnable
}	*/

function disableSelection(target){
	if (typeof target.onselectstart!="undefined") //IE route
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
		target.style.MozUserSelect="none"
	else //All other route (ie: Opera)
		target.onmousedown=function(){return false}
	target.style.cursor = "default"
}

function forbiddenCtrlKey(e) {
    //list all CTRL + key combinations you want to disable
    var forbiddenKeys = new Array('a', 'n', 'c', 'x', 'v', 'p');
    var key;
    var isCtrl;

    if(window.event) {
        key = window.event.keyCode; //IE
        if(window.event.ctrlKey)
            isCtrl = true;
        else
            isCtrl = false;
    }
	else {
        key = e.which; //Firefox
        if(e.ctrlKey)
            isCtrl = true;
        else
            isCtrl = false;
    }
    //if ctrl is pressed check if other key is in forbidenKeys array
    if(isCtrl) {
        for(i=0; i<forbiddenKeys.length; i++) {
            //case-insensitive comparation
            if(forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase()) {
//	        alert('Key combination CTRL + ' + String.fromCharCode(key) + ' has been disabled.');
	            copyIntoClipboard('Sorry! this news only view in Jomhoriyat.Com');
                return false;
            }
        }
    }
    return true;
}

function copyIntoClipboard(text) {  
    if(window.clipboardData) {  
       window.clipboardData.setData('text',text);  
    }
    return true;  
}

function initContextMenu(allow) {
	if(allow==false) {
		document.body.oncontextmenu = function() {return false;};
	} else {
		document.body.oncontextmenu = function() {return true;};		
	}
}
