﻿// JScript File

var isFirefox = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;
var isIE = (navigator.appName == "Microsoft Internet Explorer")?true:false;
var isSafari = (navigator.appName.indexOf("Netscape") != -1 && navigator.vendor.indexOf("Apple") != -1)?true:false;
var isMac=(navigator.appVersion.indexOf("Mac") != -1)?true:false;
var isMozilla=(navigator.userAgent.indexOf("Mozilla") != -1) ? true : false;
var popupwin;

  function ValidateChkList(source, arguments)
    {                       
                    
        arguments.IsValid = IsCheckBoxChecked() ? true : false;  

    }

    function IsCheckBoxChecked()
    {   
        var isChecked = false;
        var list =document.getElementById('ctl00_ContentPlaceHolder1_uxChkBxConfirmation');
        if(list != null)
        {
           if(list.checked)
           {                      
            isChecked = true;
           }
         }
         return isChecked;
    }

    function radUploadAllFieldsRequired(validator, args)  
    {
        var radUpload;            
        radUpload = document.getElementById('ctl00_ContentPlaceHolder1_uxRadUplMainImagefile0');              
        if(radUpload.value.length == 0)  
        {  
            args.IsValid = false;                                      
        }  
        else
        {
            args.IsValid = true;  
        }            
    }  

		
	function confirmationRequired(validator,args)
	{
	    var confirmCheckBox=document.getElementById('ctl00_ContentPlaceHolder1_uxChkBxConfirmation'); 
	
	    if (confirmCheckBox.checked )
	    {
	    args.IsValid=true;
	    }
	    else
	    {
	    args.IsValid=false;
	    }
	}
		
 function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		if(isMac && isMozilla)
		{
			windowWidth=self.innerWidth;
		}
		else
		{		
		    windowWidth = window.innerWidth;
		}
		
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
				
			}
		}
	}
	return windowWidth;
}


function getWindowHeight() {
	var windowHeight = 0;
	
	
	 if (typeof(window.innerHeight) == 'number') {	
		if(isMac && isMozilla)
		{
			windowHeight=self.innerHeight;
		}
		else
		{		
		    windowHeight = window.innerHeight;
		}
	}
	else {	  
     	if (window.document.documentElement && window.document.documentElement.clientHeight) {		   
			windowHeight = window.document.documentElement.clientHeight;
	    }
		else {
		
			if (window.document.body && window.document.body.clientHeight) {
				windowHeight = window.document.body.clientHeight;
				//alert("Window height in inner else is :" + windowHeight);
			}
		}
	}		
	return windowHeight;
}



function openWindow(page,title,height,width)
{



  if(isFirefox && isNaN(height))
  { 
    height=height+5;
  }   
  var popupwin=window.open(page,title,"height="+ height +",width="+ width +",left="+ getLeft(width)+",top="+ getTop(height)+ ", toolbar=0,location=0,menubar=0,scrollbars=0,status=0");
  
  popupwin.focus();
}

function getLeft(width)
{
    var left = window.parent.screen.width/2;   
    left = left - width/2 ;   
    return left;
   
}

function getTop(height)
{
    var top = window.parent.screen.height/2;
    top = top - height/2  ;   
    return top;
}

function getIFrameSize()
{

document.getElementById('framed').height = getWindowHeight()-75;
document.getElementById('framed').width = getWindowWidth() ;
}
