﻿/*var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==ctrl){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==ctrl||e.which==ctrl){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.CTRLDOWN);
document.onctrldown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onctrldown=clickIE4;
}
document.oncontextmenu=new Function("return false")*/
function fireEvent(obj, evt) {

    var fireOnThis = obj;
    if (document.createEvent) {
        var evObj = document.createEvent('MouseEvents');
        evObj.initEvent(evt, true, false);
        fireOnThis.dispatchEvent(evObj);
    } else if (document.createEventObject) {
        fireOnThis.fireEvent('on' + evt);
    }
}
function ProccessSemi(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode == 186) {
        return false;
    }
    return true;
}
function PlaySong(name, obj) {
    var so = new SWFObject("playerSingle.swf", name, "192", "67", "7", "#FFFFFF");
    so.addVariable("autoPlay", "no");
    so.addVariable("soundPath", name);
    so.write(obj);
}
function OpenCloseFiledSet(table) {
    var _table = document.getElementById(table);
    if (_table.style.display == "none") {
        _table.style.display = "block";
    }
    else {
        _table.style.display = "none";
    }
}
function OpenCloseGroupSetForum(table,img) {
    var _table = document.getElementById(table);
    var _img = document.getElementById(img);
    if (_table.style.display == "none") {
        _table.style.display = "block";
        _img.src = "/image/forum/collapse.gif";
    }
    else {
        _table.style.display = "none";
        _img.src = "/image/forum/expand.gif";
    }
}
function OkCancel() {
    if (confirm("آیا مطمئن هستید ؟")) {
        return true;
    }
    else {
        return false;
    }
}
function Change_Title_Color() {
    var LinkAdd = document.getElementById(control);
    //alert(LinkAdd.style.color);

    if (LinkAdd != null) {
        if (LinkAdd.style.color == color1) {
            LinkAdd.style.color = color2;
        }
        else {
            LinkAdd.style.color = color1;
        }
    }
}

function ShowPopUpWithScroll(url, width, height) {

    var left = (screen.width / 2) - (width / 2);
    var top = (screen.height / 2) - (height / 2);

    window.open(url, "", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + "");
}
function SetWindowPosition(window, width, height) {
    var left = (screen.availWidth / 2) - (width / 2);
    var top = (screen.availHeight / 2) - (height / 2);
    window.setPosition(left, top);
    window.setSize(width, height);
}
function copy_to_clipboard(text) {
    if (window.clipboardData) {
        window.clipboardData.setData('text', text);
    }
    else {
        var clipboarddiv = document.getElementById('divclipboardswf');
        if (clipboarddiv == null) {
            clipboarddiv = document.createElement('div');
            clipboarddiv.setAttribute("name", "divclipboardswf");
            clipboarddiv.setAttribute("id", "divclipboardswf");
            document.body.appendChild(clipboarddiv);
        }
        clipboarddiv.innerHTML = '<embed src="clipboard.swf" FlashVars="clipboard=' +
 encodeURIComponent(text) + '" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    }
    return false;
}
function addItemToList(item, list, hidden) {
    var item1 = document.getElementById(item);
    var list1 = document.getElementById(list);
    var hidden1 = document.getElementById(hidden);

    if (item1.value == '') {
        alert('پر کردن فیلد الزامی می باشد');
        return false;
    }

    for (var i = 0; i < list1.options.length; i++) {

        if (list1.options[i].value == item1.value) {

            return false;

        }

    }

    var generatedName = item1.value;
    list1.options[list1.options.length] = new Option(generatedName);


    hidden1.value = hidden1.value + item1.value + ",";

    item1.value = '';

    //list1.options[list1.options.length] = new Option(example_array[index], index);


    //list1.Add(generatedName);

    //list1.value = '';
}
function deleteItemFromList(list, hidden) {
    var list1 = document.getElementById(list);
    var hidden1 = document.getElementById(hidden);

    if (list1.options.selectedIndex == -1) {
        alert('آیتمی برای حذف انتخاب نشده');
        return false;
    }
    list1.options[list1.options.selectedIndex] = null;

    var newhidden = "";

    for (var i = 0; i < list1.options.length; i++) {

        newhidden += list1.options[i].value + ",";

    }

    hidden1.value = newhidden;

    //document.aspnetForm.ctl00_ContentPlaceHolder2_phone_list.options[document.aspnetForm.ctl00_ContentPlaceHolder2_phone_list.options.selectedIndex] = null;
}
function limitText(limitField,limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    }
}
