<!--
// Written by Dexter Zafra at www.ex-designz.net
//Handle Check Username Availability Using Ajax
 var http = createRequestObject();
 function createRequestObject() 
     {
           var xmlhttp;
	 try 
                 { 
                    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
                 }
	  catch(e) 
                 {
	    try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	    catch(f) { xmlhttp=null; }
	    }
	        if(!xmlhttp&&typeof XMLHttpRequest!="undefined") 
                        {
	  	   xmlhttp=new XMLHttpRequest();
	           }
		   return  xmlhttp;
 }
function sndRating(idnum,rateval) 
  {
  
	var dvelement = document.getElementById('dv'+idnum);
             dvelement.innerHTML = "<img src='progressimgred.gif'>";
            
            try
              {
                 //http.open('GET', 'ratingprocess.asp?id='+idnum+'&rateval='+rateval);
                 http.open('GET','ratingLinkProcess.aspx?id='+idnum+'&rateval='+rateval);
                 http.onreadystatechange = handleResponseText;
	    http.send(null);
	    dvelement.innerHTML = "Vote added";
	    
	 }
	    catch(e){
	    
	    }
	    finally{
	      parent.googlewin.close();
	    }
 }
// function sndViewed(idnum,rateval)
// {
//    var dvelement = document.getElementById('dv'+idnum);
//    
//    try
//    {
//        http.open('GET',viewedprocess.aspx?id='+idnum+'&rateval='+rateval);
//        http.onreadystatechange = handleResponseText;
//        
//        http.send(null);
//        dvelement.innerHTML = "viewed";
//    }
//    catch(e)
//    {}
//    finally{}
// }
function handleResponseText() 
  {
     try
         {
             if((http.readyState == 4)&& (http.status == 200))
                {
    	          var response = http.responseText;
                       var update = new Array();

                    if(response.indexOf('|') != -1) 
                       {
                          update = response.split('|');
                          var drelement = document.getElementById('dv'+update[0]);
                          var voteres = document.getElementById('vot'+update[0]);
                          var totalvote = document.getElementById('tv'+update[0]);
                          var starimg = document.getElementById('star'+update[0]);
                          drelement.style.display ='none';
                          voteres.innerHTML = update[2];
                          totalvote.innerHTML = update[3];
                          starimg.innerHTML = update[4].toString();
             }
	        }
        }
	catch(e){alert("an error occured");}
	finally{}
}
 function AddResource() {
     window.open('../dbdrivenvideo/DynamicControl_Creation.aspx?pageid=11&video=resource', 'Addvideo', 'width=280,height=400,resizable=yes,copyhistory=no,toolbar=no,status=no,menubar=no,scrollbars=yes,location=no', false);
 }
 
 function VerifyingUser(TableID) {
     var TableName = "tblLinks";
     window.open('../DynamicsExchange-Info/SendMail.aspx? _get_url=' + TableID + '& _get_title=' + TableName + '& pagename=CRM-Case Study', 'mywindow', 'width=1050,height=600,mywindow.moveTo(0,0),status=1,scrollbars=yes,addressbar=true ,resizable=yes');
 }

 function Addvideo() {
     window.open('../DbDrivenVideo/DynamicControl_Creation.aspx?pageid=11&video=video', 'Addvideo', 'width=320,height=400,resizable=no,copyhistory=no,toolbar=no,status=no,menubar=no,scrollbars=no,location=no', false);
 }
