
window.onload=window_onLoad;
var MMJobsPreFix='ctl00_MMJobsCph_';
var URLStartPath="http://" + window.location.host;
var	fixedX = -1			// x position (-1 if to appear below control)
var	fixedY = -1			// y position (-1 if to appear below control)

function window_onLoad() 
{
    ShowMessage();
//   v_init();
//    onloadEvents(); 
}
if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", ShowMessage, false);
}
function ShowMessage()
{
    try
    {
    	if (strMessage_Desc != "")
    	   ShowMessagewindow(strMessage_type,strMessage_title,strMessage_Desc);
    }
    catch(exp)
    {
    }
}
function ShowMessagewindow(Messagetype,Messagetitle,MessageDesc)
{


    var strImage;
    if (Messagetype=='S')
        strImage='<img id="imgerrordiv" src="../../images/Success_Message.png" hspace="5" align="left">';
    else
        strImage='<img id="imgerrordiv" src="../../images/Error_Message.png" hspace="5" align="left">';
    
    document.getElementById('divError').innerHTML="<table width='100%' align='center' cellspacing='0' cellpadding='0' border='1' class='ErrorTable'>" +
//                            "<tr>" +
//                                "<td width='6' height='6' rowspan='2' colspan='2'><img src='../../images/box_error/lt.gif' width='6' height='6' alt='' /></td>" +
//                                "<td bgcolor='#7b4317' height='1'><img src='../../images/dc.gif' width='100' height='1' alt='' /></td>" +
//                                "<td width='6' height='6' rowspan='2' colspan='2'><img src='../../images/box_error/rt.gif' width='6' height='6' alt='' /></td>" +
//                            "</tr>" +
//                            "<tr>" +
//                                "<td bgcolor='#f6f6f6' height='5'></td>" +
//                            "</tr>" +
                            "<tr>" +
//                                "<td bgcolor='#7b4317' width='1'><img src='../../images/dc.gif' width='1' height='10' alt='' /></td>" +
//                                "<td width='5' bgcolor='#f6f6f6'></td>" +
//                                "<td bgcolor='#f6f6f6' valign='top'>" + strImage + "<div class='errorMessage' id='DivErrorMessage'>" + MessageDesc + "</div></td>" +
                                "<td bgcolor='#f6f6f6' height='33' valign='center'><div style='float:left'>" + strImage + "</div><div class='errorMessage' align='left' id='DivErrorMessage'>" + MessageDesc + "</div></td>"
//                                "<td width='5' bgcolor='#f6f6f6'></td>" +
//                                "<td bgcolor='#7b4317' width='1'><img src='../../images/dc.gif' width='1' height='10' alt='' /></td>" +
                            "</tr>" +
//                            "<tr>" +
//                                "<td width='6' height='6' rowspan='2' colspan='2'><img src='../../images/box_error/lb.gif' width='6' height='6' alt='' /></td>" +
//                                "<td bgcolor='#f6f6f6' height='5'></td>" +
//                                "<td width='6' height='6' rowspan='2' colspan='2'><img src='../../images/box_error/rb.gif' width='6' height='6' alt='' /></td>" +
//                            "</tr>" +
////                            "<tr>" +
////                                "<td bgcolor='#7b4317' height='1'><img src='../../images/dc.gif' width='100' height='1' alt='' /></td>" +
////                            "</tr>" +
                        "</table>";                     
                        
                        
//Second Error For Login..
try
{

    if(document.getElementById('divErrorError2').innerHTML!="Object required")
    {

      document.getElementById('divErrorError2').innerHTML="<table width='100%' align='center' cellspacing='0' cellpadding='0' border='1' class='ErrorTable'>" +

                                "<tr>" +
                                    "<td bgcolor='#f6f6f6' height='33' valign='center'><div style='float:left'>" + strImage + "</div><div class='errorMessage' align='left' id='DivErrorMessage'>" + MessageDesc + "</div></td>"
                            "</table>";   
    }   
}    
catch(ex)
{}           
                                
    
}

function $() {
  var elements = new Array();
  
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    try
    {
		if (typeof element == 'string')
		element = document.getElementById(element) || document.all(element) || document.forms(0).all(element);
    }
    catch(ex)
    {
		element = null;
    }

    if (arguments.length == 1) 
      return element;
      
    elements.push(element);
  }
  
  return elements;
}

function CheckForDelete()
{
     if(confirm('Do you want delete?') == true)
     {
        return true;
     }
     return false;
}
function CheckForDelete_ForSongInPlayList()
{
     if(confirm('Song is already in playlist?Do you want delete?') == true)
     {
        return true;
     }
     return false;
}

function checkRequiredField(eleId)
{
    if(eleId != '' && eleId != null)
    {
        var txtCtrl = document.getElementById(eleId)
        if(txtCtrl != 'undefined' && txtCtrl != null)
        {
            var txt = new String(txtCtrl.value);
            if(txt.trim() != '')return true;
        }
    }
    return false;
}
function validateEmail(str) 
{
     var illegalChars = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/; // allow only letters and numbers
     var strng =str;
     if (!illegalChars.test(strng))
     {
     return false;
     }
     return true;
}
function AllowNumericOnly(e)
{
  try
  {
      if (!(event.keyCode >=48 && event.keyCode <= 57 ))
      {
         return false
      }
  }
  catch(exception)
  {
      if (e.charCode==0) return true;  
      if (!(e.charCode >=48 && e.charCode <= 57 ))
      {
        return false
      }
  }
}
function isValidURL(url) {
    var startstring = url.substring(0, 4);
    var Laststring = url.substring(url.length - 4);
    if (startstring == 'www.' && Laststring == '.com') {
        return true;
    }
    else {
         return false;
    }
}


function Show_Window(url,width,height)
{
    thiswidth=width;  
    thisheight=height;
    thistopposition=40
    thisleftpos=180
	
    tiswidth=thiswidth
    tisheight=thisheight
    tistopposition=thistopposition

    resizable = 1;
    toolbar=0
    menubar=0
    scrollbars=1

    tisheight = tisheight + 20;

    window.open(url, '', "top="+tistopposition+",left="+thisleftpos+",width="+tiswidth+",height="+tisheight+",scrollbars="+scrollbars+",resizable="+resizable+",status="+status+",toolbar="+toolbar+",location="+location+",menubar="+menubar);
}

function AllowAlphaNumericOnly(e)
{
 
    try
    {
     if(event.keyCode!=32)
     {
      if (!((event.keyCode>=65 && event.keyCode <= 90) || (event.keyCode>=97 && event.keyCode <= 122) || (event.keyCode >=48 && event.keyCode <= 57 ) ))
        {
          
             return false
        }
     }
     
    }
    catch(exception)
    {
    if(e.charCode!=32)
     {
        if (!((e.charCode>=65 && e.charCode <= 90) || (e.charCode>=97 && e.charCode <= 122) || (e.charCode >=48 && e.charCode <= 57 ) ))
        {
        
             return false
        }
        
     }
        
    }
}
function CheckMaximumLength(evt,len)
{
 var str=document.getElementById(evt.id);
 if(str.value.length<len)
 {
   return true;
 }
 else
 {
  return false;
 }
}


var t1,t2;	// for setTimeouts
var tipOn = false;	// check if over tooltip link
function ShowTooltip(ctl,e)
{
 if (t1) clearTimeout(t1);	if (t2) clearTimeout(t2);
	    tipOn = true;   
        var	leftpos=0
		var	toppos=0
	    aTag = ctl
		do {
			aTag = aTag.offsetParent;			
			if( aTag != null)
			{
			    leftpos	+= aTag.offsetLeft;
			    toppos += aTag.offsetTop;
			}
		} while(aTag != null && aTag.tagName!="BODY");

       
        if (parseInt(navigator.appVersion)>3) {      
         if (navigator.appName=="Netscape")
          {
         
          winW = window.innerWidth;
          winH = window.innerHeight;        
         }        
         if (navigator.appName.indexOf("Microsoft")!=-1) {
          winW = document.body.offsetWidth;
          winH = document.body.offsetHeight;
         }
        }
        
        posX= ((winW-960)/2)+230;       
      
        actualX=e.clientX - 230; 
        //alert(actualX);
      $("popTd").innerHTML=GetInnerHtml('rte1'); 
		var cLeft =	leftpos-560;		 		
		document.getElementById("popText").style.left = actualX + "px";		
	    var cTop = toppos; //	ctl.offsetTop; //+	toppos + ctl.offsetHeight +	2 :	fixedY
		document.getElementById("popText").style.top = cTop + "px";
        $("popText").style.visibility= "visible";
		return false;
}
function HideTooltip()
{ 
    document.getElementById("popText").style.visibility="hidden";
}

function CompareDates(value1,value2) 
{

    if (Date.parse(value1) > Date.parse(value2))
    {
         return false;
        //alert("Invalid date")
    }
    else
    {
        return true;
    }


//  var date1, date2;
//  var month1, month2;
//  var year1, year2;
//    date1 = value1.substring (0, value1.indexOf ("/"));
//    month1 = value1.substring (value1.indexOf ("/")+1, value1.lastIndexOf ("/"));
//    year1 = value1.substring (value1.lastIndexOf ("/")+1, value1.length);
//    date2 = value2.substring (0, value2.indexOf ("/"));
//    month2 = value2.substring (value2.indexOf ("/")+1, value2.lastIndexOf ("/"));
//    year2 = value2.substring (value2.lastIndexOf ("/")+1, value2.length);
//    //var m1=ReturnMonthNo(month1)
//   // var m2=ReturnMonthNo(month2)
//   
//   var m1=month1;
//   var m2=month2;
//   
//    var from = new Date(year1, m1, date1); 
//    var to = new Date(year2, m2, date2); 

//    if(from>to)
//    {
//    return false;
//    }
//    else
//    {
//    return true;
//    }
    
} 
 function ReturnMonthNo(month)
    {
    var m
    if(month=='Jan')
    {
    m=0;
    }
    else if(month=='Feb')
    {
    m=1;
    }
    else if(month=='Mar')
    {
    m=2;
    }
    else if(month=='Apr')
    {
    m=3;
    }
    else if(month=='May')
    {
    m=4;
    }
    else if(month=='Jun')
    {
    m=5;
    }
    else if(month=='Jul')
    {
    m=6;
    }
    else if(month=='Aug')
    {
    m=7;
    }
    else if(month=='Sep')
    {
    m=8;
    }
    else if(month=='Oct')
    {
    m=9;
    }
    else if(month=='Nov')
    {
    m=10;
    }
    else if(month=='Dec')
    {
    m=11;
    }
    return m
    }
    
    
function AllowNumericDateFormatOnly(e)
{
//This is for Allow Date Format
  try
  {
      if (!(event.keyCode >=47 && event.keyCode <= 57 ))
      {
         return false
      }
  }
  catch(exception)
  {
      if (e.charCode==0) return true;  
      if (!(e.charCode >=47 && e.charCode <= 57 ))
      {
        return false
      }
  }
}
