﻿// JScript File
function buttonGoUni(){
    if(document.getElementById('uniID').value=="" && document.getElementById('uniType').value=="")
        alert('Please select a university');
    else 
        window.open('/Uni_Profile.aspx?id='+document.getElementById('uniID').value+'&type='+document.getElementById('uniType').value,'_self');
}
   
var objPre;
var objStylePre;
function selectUni(obj, valid, type)
{    

if(document.all){
    if(objPre){
        objPre.parentElement.parentElement.className = objStylePre;
    }
    objPre=obj;
    objStylePre = objPre.parentElement.parentElement.className;
    objPre.parentElement.parentElement.className = "rowselect";
}
else{
    if(objPre){
        objPre.parentNode.parentNode.className = objStylePre;
    }
    objPre=obj;
    objStylePre = objPre.parentNode.parentNode.className;
    objPre.parentNode.parentNode.className = "rowselect";
}

        var a_uni = document.getElementById('uniID');
        if(a_uni && obj)  {  
            a_uni.value=obj.id;//valid;
            a_uni.value = a_uni.value.replace("uni_","");
        }
        var a_type = document.getElementById('uniType');
        if(a_type && type){
           a_type.value=type;//valid;         
        }
        setStyle(obj, 1);

/*       
     var obj = document.getElementById('panel_uniinfo');
        obj.style.display = 'none';
  //  if(type=="profile"){        
        var objw = document.getElementById('panel_wait');
        objw.style.display = 'block';
           
       // table_RowSelect(obj)    
       // var a_uni = document.getElementById('uniID');
       // if(a_uni)    
         //   a_uni.value=valid;
        
        AIAx_DoCallBack('panel_uniinfo',valid);
    //}
*/
}

function openUni(obj, valid,type)
{
    if(obj && valid != "" && type){
        window.open('/Uni_Profile.aspx?id='+valid+'&type='+type,'_self');
    }
}

function selectUniSeo(obj, valid)
{    

if(document.all){
    if(objPre){
        objPre.parentElement.parentElement.className = objStylePre;
    }
    objPre=obj;
    objStylePre = objPre.parentElement.parentElement.className;
    objPre.parentElement.parentElement.className = "rowselect";
}
else{
    if(objPre){
        objPre.parentNode.parentNode.className = objStylePre;
    }
    objPre=obj;
    objStylePre = objPre.parentNode.parentNode.className;
    objPre.parentNode.parentNode.className = "rowselect";
}

        var a_uni = document.getElementById('uniSeo');
        if(a_uni && obj)  {  
            a_uni.value=valid;
        }
        setStyle(obj, 1);

/*       
     var obj = document.getElementById('panel_uniinfo');
        obj.style.display = 'none';
  //  if(type=="profile"){        
        var objw = document.getElementById('panel_wait');
        objw.style.display = 'block';
           
       // table_RowSelect(obj)    
       // var a_uni = document.getElementById('uniID');
       // if(a_uni)    
         //   a_uni.value=valid;
        
        AIAx_DoCallBack('panel_uniinfo',valid);
    //}
*/
}
function buttonGoSeo(){
    var a_uni = document.getElementById('uniSeo')
    if(a_uni && a_uni.value!="")
        window.open(a_uni.value,'_self');
        //window.open('/Uni_Profile.aspx?id='+document.getElementById('uniID').value+'&type='+document.getElementById('uniType').value,'_self');
        
    else 
        alert('Please select a university');
}
function openUniSeo(valid)
{
    if(valid != null && valid != ""){
        window.open(valid,'_self');
    }
}

function table_SelectRow(objid){
    var tbl = document.getElementById(objid);
}

function setStyle(obj, a)
{
   if(obj){
    if(a==1)
      table_RowHover(obj)
    else
      table_RowUnhover(obj)
   }
}

var row_curr = null;
var rowstyle = new Object();
rowstyle.itemClass = ""
rowstyle.selectClass = "rowselect"
rowstyle.hoverClass = "rowhover"

function table_RowSelect(tbl_row) {
    if(tbl_row){
        table_RowUnselect(row_curr);
        tbl_row.className += ' ' + rowstyle.selectClass;
        row_curr = tbl_row;
        
    }    
}
function table_RowUnselect(tbl_row) {
    if(tbl_row){
        var re = new RegExp(rowstyle.selectClass,"ig")
        tbl_row.className = tbl_row.className.toString().replace(re, '');
        //tbl_row.className = tbl_row.className.replace(' '+rowstyle.selectClass, '');
    }
}
function table_RowHover(tbl_row) {
    if(tbl_row && tbl_row != row_curr){
        tbl_row.className += ' ' + rowstyle.hoverClass;
    }    
}
function table_RowUnhover(tbl_row) {
    if(tbl_row){
        var re = new RegExp(rowstyle.hoverClass,"ig")
        tbl_row.className = tbl_row.className.toString().replace(re, '');
        //tbl_row.className = tbl_row.className.replace(' '+rowstyle.hoverClass, '');
    }
}

/* call back*/
function AIAx_DoCallBack(target,param) {
        var targetPanel = document.getElementById(target);
        if(!targetPanel)
            targetPanel = this;

        WebForm_DoCallback(target,param,AIAx_CallBackResult,targetPanel,AIAx_CallBackResult,false);
}
function AIAx_CallBackResult(result, context) {
        var objw = document.getElementById('panel_wait');
        objw.style.display = 'none';
        if(context.innerHTML && result){               
            context.innerHTML = result; 
            context.style.display = 'block';           
        }       
        else context.style.display = 'none';
}
function CloseInfo(objid)
{        
    var obj = document.getElementById(objid);
    obj.style.display = 'none';
}

