function selectAllCheckboxes(checboxListID, checkboxesCount, checked)
{
    if (checboxListID)
    {
        var checkBoxList = document.getElementById(checboxListID);
        if (checkBoxList)
        {
            for (count = 1; count < checkboxesCount; count++)
            {
                var checkBoxID = checboxListID + '_' + count;
                var checkBox = document.getElementById(checkBoxID);
                checkBox.checked = checked;           
            }
        }
    }
}

var __callBackStatus = null;

function __doCallback(aspNetCallbackCode)
{
    var interval = window.setInterval(
        function ()
        {
            if (__callBackStatus == null)
            {
                try
                {
                    __callBackStatus = -1;
                    eval(aspNetCallbackCode);
                    window.clearInterval(interval);
                }
                catch(e)
                {
                }
                
                return;
            }
        }, 10);
}


function closePopupWindow(refreshParent)
{
    if (refreshParent)
    {
        var opener = window.opener;
        if (opener)
        {
            window.opener.location = window.opener.location;
        }
    }

    window.close();
}

function handleElementVisibility(elementID, cookieName, isClickAction, isFirstLoad, visibility)
{
	if (isFirstLoad)
	{
		if (cookieName && cookieName != '')
		{
		    if (visibility == true)
		    {
		        setCookie(cookieName, 'expand');	
		    }
		    else
		    {
		        deleteCookie(cookieName);
		    }
		}
	}
	
	var area = document.getElementById(elementID);
	
	if (!area)
	{
		return;
	}
	
	if (!isClickAction)
	{
		var visible;
		if (cookieName && cookieName != '')
		{
			visible = getCookie(cookieName);
		}
		
		if (visible == 'expand')
		{
			area.style.display = '';
		}
		else
		{
			area.style.display = 'none';
		}
	}
	else
	{
		var cookieValue;
		if (area.style.display == 'none')
		{
			area.style.display = '';
			cookieValue = 'expand';
		}
		else
		{
			area.style.display = 'none';
			cookieValue = 'collapse';
		}
		
		if (cookieName && cookieName != '')
		{
			setCookie(cookieName, cookieValue);	
		}
		
	}
}

function showLoadingHint()
{
  loadingHint = document.getElementById('LoadingHintArea'); 
  loadingHintBackground = document.getElementById('LoadingBackground'); 
  if (loadingHint != null && loadingHintBackground != null)
  {  
    loadingHint.style.display = '';
    loadingHint.style.left = tempX + 5 + 'px';
    loadingHint.style.top = tempY + 5 + 'px';    
    loadingHintBackground.style.display = '';    
    loadingHintBackground.style.width = document.body.offsetWidth + 'px';
    loadingHintBackground.style.height = document.body.offsetHeight + 'px';
  }
}

function hideLoadingHint()
{
  loadingHint = document.getElementById('LoadingHintArea'); 
  loadingHintBackground = document.getElementById('LoadingBackground'); 
  if (loadingHint != null && loadingHintBackground != null)  
  {
    loadingHint.style.display = 'none';
    loadingHintBackground.style.display = 'none';
    loadingHintBackground.style.width = '0px';
    loadingHintBackground.style.height = '0px';
  }
}
/* Document Management - Create from template first step*/
function documentNextStepConfirmation(checkName)
{
	if (!checkSelection(checkName)) 
	{	
		return false;
	}
	
    return true;
}

function setClass(obj, cl){
	if (obj.className!=cl) obj.className = cl;
}

function makeGray (obj, state, text){
	if (state && (obj.value == '')){
		obj.value = text;
	} else if (!state && (obj.value == text)){
		obj.value = '';
	}
}


function changeDisplayById(objId){
	for (c = 0; c < changeDisplayById.arguments.length; c++){
		obj = document.getElementById(changeDisplayById.arguments[c]);
		if (obj.style.display == 'none') obj.style.display = 'block';
		else obj.style.display = 'none';
	}
}

function gotoURL(url, target, callback){
  
	if (!url) url = "/";

	if(typeof callback == "function")
		callback(url);

	if(target && target!='_self'){
		popupURL(url, target);
	}
	else{
		if (window.event){
			var src = window.event.srcElement;
			if((src.tagName != 'A') && ((src.tagName != 'IMG') || (src.parentElement.tagName != 'A'))){
				if (window.event.shiftKey) window.open(url);
				else document.location = url;
			}
		} else document.location.href = url;
	}
}


function popupURL(url, options){
	window.open(url, 'PopupWindow', options);
}

function getLeftPos(obj){
	var res = 0;
	while (obj){
		res += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return res;
}

function getTopPos(obj){
	var res = 0;
	while (obj){
		res += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return res;
}

function CheckAll(formObj, checkName, checkVal){
	var el = formObj.elements;
	for (count = 0; count < el.length; count++)
		if (el[count].name == checkName + '[]')
			if (!el[count].disabled) el[count].checked = checkVal;
}

function ExamAll(formObj, checkName, resName){
	var checkCount = 0;
	var boxCount = 0;
	var el = formObj.elements;
	for (count = 0; count < el.length; count++)
		if (el[count].name == checkName + '[]'){
			boxCount++;
			if (el[count].checked || el[count].disabled) checkCount++;
		}
	formObj.elements[resName].checked = (checkCount == boxCount);
}

function CheckAll(checkName, checkVal)
{
	var checkCount = 0;
	var el = document.forms[0].elements;
	for (count = 0; count < el.length; count++)
	{	  
		if (el[count].name == checkName)
		{
			if (!el[count].disabled)
			{
				el[count].checked = checkVal;
			}
			checkCount++;
		}
	}
}

function ExamAll(checkName, resName)
{
	var checkCount = 0;
	var boxCount = 0;
	var el = document.forms[0].elements;
	
	for (count = 0; count < el.length; count++)
	{
		if (el[count].name == checkName)
		{
			boxCount++;
			if (el[count].checked || el[count].disabled) checkCount++;
		}
	}
	
	if (document.forms[0].elements[resName])
		document.forms[0].elements[resName].checked = (checkCount == boxCount);
}

function chbIsAllEmpty(formObj, checkName){
	var checkCount = 0;
	var boxCount = 0;
	var el = formObj.elements;
	for (count = 0; count < el.length; count++)
		if (el[count].name == checkName + '[]'){
			boxCount++;
			if (el[count].checked) checkCount++;
		}
	return(checkCount == 0);
}

function chbIsOnlyOne(formObj, checkName){
	var checkCount = 0;
	var boxCount = 0;
	var el = formObj.elements;
	for (count = 0; count < el.length; count++){
		if (el[count].name == checkName + '[]'){
			boxCount++;
			if (el[count].checked) checkCount++;
		}
	}
	return(checkCount == 1);
}

function disableAll(){
	for (c1 = 0; c1 < document.forms.length;  c1++){
		var formElements = document.forms[c1].elements;
		for (c2 = 0; c2 < formElements.length;  c2++) formElements[c2].disabled = true;
	}
}

// name - cookie name
// value - cookie value
// [expires] - Date object (by default cookie expires at the end of browser session)
// [path]
// [domain]
// [secure]
function setCookie(name, value, expires, path, domain, secure)
{
	var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")

	if ( (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
}

// name - cookie name
function getCookie(name)
{
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

// name - cookie name
// [path]
// [domain]
function deleteCookie(name, path, domain)
{
	if (getCookie(name))
	{
		document.cookie = name+"="+
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                "; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}


function preLoad() {
	if(document.images)  {
		var argLen = arguments.length;
		for(var i = 0; i < argLen; i++) {
			var arg = arguments[i];
			self[arg] = new Image();
			self[arg].src = arg;
		}
	}
}

function ch_img(obj, img ) {
	if (self[img]) {
		obj.src = self[img].src;
	}
}

function mm_act(obj,img,cl,num,selected){
	
	if ( cl == 'item act' )
		showMenu(obj, num);
	else
		hideMenu(obj, num);
	
	if ( selected ) return;
	
	while (obj) {
		obj = obj.childNodes[0];
		if ( obj && obj.tagName == 'IMG') {
			ch_img(obj,img);
			break;
		}
	}
	
	while (obj && cl!='') {
		obj = obj.parentNode;
		if ( obj && obj.tagName == 'DIV') {
			obj.className = cl;
			break;
		}
	}
}

function popup_view (url, w, h, wname) {
	scr_left = 0;
	scr_top = 0;
	wname = wname;
	new_window = window.open (url, wname , "title=image,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width="+w+",height="+h+",top="+scr_top+",left="+scr_left);
	new_window.focus();
	return new_window;
}

function LTrim(str)
{
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
    var j=0, i = s.length;
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;
    s = s.substring(j, i);
  }

  return s;
}

function RTrim(str)
{
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {

    var i = s.length - 1;      
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;
    s = s.substring(0, i+1);
  }

  return s;
}

function Trim(str)
{
  return RTrim(LTrim(str));
}

function headerKeydown(Url, Header)
{
    var reg = /[\x21-\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5e\x60\x7b\x7d\xa3]/ig;
    var regAnd = /&/ig;
    var regS = /[\s\x2f]/ig;

    var val = Trim(Header.value.toLowerCase()).replace(reg,"").replace(regAnd,"and").replace(regS,"-").replace(/\x2D{2,}/ig,'-');
    
    //Url.value = (val.length > 0) ? val + ".aspx" : "";
    Url.value = val;
}

function checkSelection(checkName) {
	var checkCount = 0;
	var el = document.forms[0].elements;
	for (count = 0; count < el.length; count++)
	{	  
		if (el[count].name == checkName)
		{
			if (!el[count].disabled)
			{
				if (el[count].checked) {
			    checkCount++;				  
				}
			}
		}
	}
	if (checkCount == 0) {
	  alert('Please select at least one item.');
	  return false;
	}
	return true;
}

function selectConfirmation(checkName) 
{
	if (!checkSelection(checkName)) 
	{
		return false;
	}
	
	return true;
}

function customDeleteConfirmation(checkName, message)
 {
  if (!checkSelection(checkName)) {
    return false;
  }
  if (!confirm(message)) {
    return false;
  }
  else {
    return true;
  }
}

function deleteConfirmation(checkName) {
  if (!checkSelection(checkName)) {
    return false;
  }
  if (!confirm('You are trying to delete item(s). \n\nAre you sure you wish to continue?')) {
    return false;
  }
  else {
    return true;
  }
}



function showConfirmation(text) {
  return confirm(text);
}

var checkedCount = 0;

function updateCheckedCount(checkBox) {
  if (checkBox.checked) {
    checkedCount += 1;
  }
  else {
    checkedCount -= 1;  
  }
}

var allCheckedChildren = null;

function checkAllChild(id, checked) {
  allCheckedChildren = document.getElementById(id + 'AllCheckedChildren');
  if (allCheckedChildren == null) {
    allCheckedChildren = document.createElement('input', 'checkedNodes');
    allCheckedChildren.setAttribute('id', id + 'AllCheckedChildren');
    allCheckedChildren.setAttribute('name', id + 'AllCheckedChildren');
    allCheckedChildren.setAttribute('type', 'hidden');
    document.forms[0].appendChild(allCheckedChildren);
  }
  var cell = document.getElementById('subItems' + id);
  if (cell != null) {  
    checkChild(cell, checked);
  }
}

function checkChild(element, checked) {
  if (element.tagName != 'TABLE' && element.tagName != 'TBODY' && element.tagName != 'TR' && element.tagName != 'TD' && element.tagName != 'DIV') {
    return;
  }
  if (element.childNodes != null) {
    var i = 0;
    for (i = 0; i < element.childNodes.length; i++) {
      if (element.childNodes[i].type == 'checkbox') {
        element.childNodes[i].checked = checked;        
        element.childNodes[i].disabled = checked;
        if (checked) {
          addNodeToChecked(element.childNodes[i].id);
        }
      }      
      checkChild(element.childNodes[i], checked);      
    }    
  }  
}

function addNodeToChecked(nodeId) {
  if (allCheckedChildren.value.length > 0) {
    allCheckedChildren.value += ',';
  }
  allCheckedChildren.value += nodeId;
}

function deleteFromTreeConfirmation() {
  if (checkedCount <= 0) {
    alert('You must check any item!');  
    return false;
  }
  if (!confirm('You are trying to delete item(s). \n\nAre you sure you wish to continue?')) {
    return false;
  }
  else {
    return true;
  }
}

function checkedChanged(id, list)
{
    if (typeof list[id] != "undefined" && list[id].checked)
    {
        for (var i=0; i<list.length; ++i)
        {
            if (i != id)
            {
                list[i].checked = false;
            }
        }
    }
}

function isIE() {
  return (navigator.userAgent.indexOf('MSIE') != -1 && navigator.userAgent.indexOf('Opera') == -1);
}

function isOpera() {
  return (navigator.userAgent.indexOf('Opera') != -1);
}

function isFirefox() {
  return (navigator.userAgent.indexOf('Firefox') != -1 && navigator.userAgent.indexOf('Opera') == -1);
}

function isMozila() {
  return (navigator.userAgent.indexOf('Mozila') != -1 && navigator.userAgent.indexOf('Opera') == -1 && navigator.userAgent.indexOf('MSIE') == -1);
}

var isModified = false;
var isNew = false;
var saveButtonId = '_saveButton_';
var textAreas = '';
var isValid = true;
var ingnoreModification = false;

function tabMenuRedirect(url, postBackReference) {
  if(ingnoreModification)
  {
      window.location = url;
  }
  else
  {
      if (isNew || isModified || !isValid) {
        if (confirm('You should save your changes before proceeding to the next step!')) {
          eval(postBackReference);
        }
      }
      else {
        window.location = url;
      }
  }
}

function changeSaveButtonEnabled(enable) {
  saveButton = document.getElementById(saveButtonId);
  if (saveButton != null) {
    if (enable) {
      saveButton.disabled = '';
      /*saveButton.setAttribute('class', 'buttons');*/
      isModified = true;
    }
    else {
      /*saveButton.disabled = 'disabled';
      saveButton.setAttribute('class', 'buttons-disabled');      */
    }
  }
}

function addTextArea(textAreaId) {
  if (textAreas.length > 0) {
    textAreas += ",";
  }
  textAreas += textAreaId;
}

function getFrameContent(frame) {
  return frame.contentDocument;
}

function fckEditorOnFocus(editorInstance) {
  changeSaveButtonEnabled(true);
}

function initializetextArea(textAreaId) {
  if (isOpera()) {
    for (i = 0; i < 10; i++) {
      textAreaId = textAreaId.replace('_', '$');
    }
    textArea = document.getElementById(textAreaId);    
    if (textArea == null) {
      return true;
    }
    textArea.setAttribute('onkeyup','changeSaveButtonEnabled(true)');
    return true;
  }
  if (window.FCKeditorAPI == null) {
    return false;
  }
  var editorInstance = FCKeditorAPI.GetInstance(textAreaId) ; 
  if (editorInstance != null) {
    editorInstance.Events.AttachEvent( 'OnFocus', fckEditorOnFocus ) ;
  }  
  return true;
}

function setTabItemVisibility(idElement, visible) {
  element = document.getElementById(idElement);
  if (element == null) {
    return false;
  }
  if (visible) {
    displayValue = '';
  }
  else {
    displayValue = 'none';
  }
  element.style.display = displayValue;
  tabRow = document.getElementById('TabMenuTableRow');
  var i = 0;
  var offSet = 1;
  if (isFirefox()) {
    offSet = 2;
  }
  for (;i < tabRow.childNodes.length; i++) {
    if (tabRow.childNodes[i] == element) {
      if (i > offSet) {
        tabRow.childNodes[i - offSet].style.display = displayValue;
      }
      else {
        tabRow.childNodes[i + offSet].style.display = displayValue;     
      }
      return true;      
    }
  }
  return true;  
}

function removeFile(UploadRowId, PreviewRowId, StateId) {
  uploadRow = document.getElementById(UploadRowId);
  previewRow = document.getElementById(PreviewRowId);  
  stateField = document.getElementById(StateId);
  if (uploadRow == null || previewRow == null || stateField == null) {
    return;
  }
  uploadRow.style.display = '';
  previewRow.style.display = 'none';
  stateField.value = 'True';
}

function deleteFileSource(scriptName, linkToPage)
{
    var script = document.getElementById(scriptName);
    var s = document.createElement('script');
    s.id = ('delete_image_js');
    s.type='text/javascript';
    document.body.appendChild( s );
    document.getElementById(s.id).src = linkToPage;
}

function findLink(parentElement, text) {
  if (parentElement.childNodes != null) {
    var i = 0;
    for (i = 0; i < parentElement.childNodes.length; i++) {
      if (parentElement.childNodes[i].tagName == 'A' && parentElement.childNodes[i].innerHTML == text) {
        return parentElement.childNodes[i];
      }
      else {
        result = findLink(parentElement.childNodes[i], text);
        if (result != null) {
          return result;
        }
      }      
    }
    return null;    
  }  
}

function changeTreeNodeVisibility(linkElement, visibile) {
  if (linkElement == null) {
    return;
  }
  temp = linkElement;
  while (temp != null && temp.tagName != 'TABLE') {
    temp = temp.parentNode;
  }
  if (temp != null) {
    if (visibile) {
      temp.style.display = '';
    }
    else {
      temp.style.display = 'none';
    }
  }
}

function hideElement(id) {
  hidedEelement = document.getElementById(id);
  if (hidedEelement != null) {
    hidedEelement.style.display = 'none';
  }
}


function doCustomPostBack(controlID, eventArgs) {
  document.getElementById('CustomPostBackEventArgs').value = eventArgs;
  __doPostBack(controlID, '');
}

function doAjaxControlPostBack(containerID, controlID, eventArgs) {
  document.getElementById('CustomPostBackEventArgs' + containerID).value = eventArgs;
  __doPostBack(controlID, '');
}

function keyUpHandler (eventArgs, containerID, controlID, postBackEventArgs) {
    key = eventArgs.which;
    if (key == 13) {
      doAjaxControlPostBack(containerID, controlID, postBackEventArgs);
      return false;
    }
    return true;
}

function KeyDownFunctionOnSearch(event, buttonID)
{
    if (event.keyCode==13) 
    {
         __doPostBack(buttonID, 'SortPostBack');
         return false;
    } 
}
function addConfirmation(checkName) {
	var checkCount = 0;
	var el = document.forms[0].elements;
	for (count = 0; count < el.length; count++)
	{	  
	  if (!el[count].disabled)
			{
				if (el[count].checked) {
			    checkCount++;				  
				}
			}
	}
	if (checkCount == 0) {
	  alert('Please select at least one item.');
	  return false;
	}
	return true;
}

function IsNotApprouvedStatus(nowStatusID, ApprouveStatusID)
{
  if(nowStatusID != ApprouveStatusID)
  {
    alert('This action only for approuved quotes.');
    return false;
  }
  return true;
}

function ClearLookup(TextBoxID, ButtonID)
{
  var lookupTextBox = document.getElementById(TextBoxID);
  var lookupButton = document.getElementById(ButtonID);
  lookupTextBox.value = "";
  lookupButton.style["display"] = "none";

}

 function openFile(fileNameWithUrl)
 {
    document.location.href = fileNameWithUrl; 
 }
 
  function setPosition(positionedElementID, neighboringElementID) 
  {
    obj = document.getElementById(neighboringElementID);
    if(obj == null)
    {
      return;
    }
    var x=0, y=0;
    while(obj) {
      x+=obj.offsetLeft;
      y+=obj.offsetTop;
      obj=obj.offsetParent;
    }
    
    positionedElement = document.getElementById(positionedElementID);
    if(positionedElement == null)
    {
      return;
    }
    positionedElement.style.top = y;
    positionedElement.style.left = x - positionedElement.clientWidth + 50;
    return;
}

/*******************  Extended DropDown Scripts  *********************/

//var selectElementIDs = new Array();
var isNeedHide = false;
var isFirstOpen = false;

function formOnclick(selectedMenuID)
{
  var selectedMenu = document.getElementById(selectedMenuID);
  if(selectedMenu != null )
  {
    if(selectedMenu.style["display"] == "none")
    {
      return;
    }
  }
  else
  {
    return;
  }
  if(isNeedHide && !isFirstOpen)
  {
    hideMenu(selectedMenuID);
  }
  else
  {
    isFirstOpen = false;
  }
}

function viewDropDownMenu(selectedMenuID, dropDownListID)
{
  var selectedMenu = document.getElementById(selectedMenuID);
  var dropDownList = document.getElementById(dropDownListID);
  if(selectedMenu != null)
  {
    if(selectedMenu.style["display"] != "none")
    {
      isNeedHide = false;
      selectedMenu.style["display"] = "none";
      
//      if(selectElementIDs.length > 0)
//      {
//        for(i = 0; i < selectElementIDs.length; i++)
//        {
//          var element = document.getElementById(selectElementIDs[i]);
//          element.style["display"] = "";
//        }
//      }
      
    }
    else
    {
      isNeedHide = true;
      isFirstOpen = true;
      selectedMenu.style["display"] = "";
      
//      var selectList =  document.getElementsByTagName('select');
//      
//      if(selectList != null)
//      {
//        var counter = 0;
//        for(var nextSelect in selectList)
//        {
//          if(selectList[nextSelect].style != null)
//          {
//            if(selectList[nextSelect].style["display"] != "none")
//            {
//            selectList[nextSelect].style["display"] = "none";
//            selectElementIDs[counter] = selectList[nextSelect].id;
//            counter++;
//            }
//          }
//        }
//      }
    }
  }
}

function selectedValueChange(selectedValue, selectedText, selectedValueSpanID, dropDownListID, selectedMenuID)
{
  var selectedValueSpan = document.getElementById(selectedValueSpanID);
  var dropDownList = document.getElementById(dropDownListID);
  
  if(selectedValueSpan != null && dropDownList != null)
  {
  
    for(i = 0;;i++)
    {
      if(dropDownList.options[i] == null)
      {
        break;
      }
      if(dropDownList.options[i].value == selectedValue)
      {
          dropDownList.options[i].selected = true;
          break;
      }
    }
    
    selectedValueSpan.innerText = selectedText;
    selectedValueSpan.textContent = selectedText;
    selectedValueSpan.title = selectedText;
  }
  
  hideMenu(selectedMenuID);
}

function setBackground(control, color)
{
  control.style["backgroundColor"] = color;
}

function setColor(control, color)
{
  control.style["color"] = color;
}

function hideMenu(selectedMenuID)
{
  var selectedMenu = document.getElementById(selectedMenuID);
  isNeedHide = false;
  selectedMenu.style["display"] = "none";
      
//  if(selectElementIDs.length > 0)
//  {
//    for(i = 0; i < selectElementIDs.length; i++)
//    {
//      var element = document.getElementById(selectElementIDs[i]);
//      element.style["display"] = "";
//    }
//  }
}

/******************* End Extended DropDown Scripts  *********************/

function getValueByID(id)
{
  var element = document.getElementById(id);
  if(element != null)
  {
    return element.value;
  }
  else
  {
    return '';
  }
}

function gotoURLForLookUp(url, target, callback, id)
{ 
  var value = getValueByID(id);
  if(value != '')
  {
    url += '&SearchExpression=' + value;
  }
  
  gotoURL(url, target, callback);
}

    function getStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}