﻿// JScript File
function Toggle( clientId )
{
    var prefix = "ctl00_WizardContent_";
 
	var div = document.getElementById(clientId + "_DataPanel");
	var img = document.getElementById(clientId + "_ActionImage");

	if ((div.style.display == "block") || (div.style.display == ""))
	{	
		div.style.display = "none";
		img.src = document.getElementById(prefix + "ExpandHidden").src;
	}
	else
	{	
		div.style.display = "block";
		img.src = document.getElementById(prefix + "CollapseHidden").src;
	}
}

function SetCursorToTextEnd(textControlID)
{

    var text = document.getElementById(textControlID);
    if (text != null && text.value.length > 0)
    {
        if (text.createTextRange)
        {
            var FieldRange = text.createTextRange();
            FieldRange.moveStart('character', text.value.length);
            FieldRange.collapse();
            FieldRange.select();
        }
    }
}

function CheckQAStatus(id) {
    __doPostBack("onCheckQAStatus", id);
}

function onPriceKeyup(e) {
    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        __doPostBack("onPriceKeyup", "");
    }
}

function onTimeKeyup(e) {
    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        __doPostBack("onTimeKeyup", "");
    }
}

function onKeyup(e) {
    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        __doPostBack("onKeyup", "");
    }
}


function onMemoKeyup(e) {    
    var key;
    
    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        __doPostBack("onMemoKeyup", "");
    }
}

function onAnswerKeyup(e) {

   var key;
    
    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        __doPostBack("onAnswerKeyup", "");        
    }
}

function onAnswerClick()
{       
     __doPostBack("onAnswerClick", "");
}


function onNextClick() {    
    __doPostBack("onNextClick", "");
}

function onPrevClick() {
    __doPostBack("onPrevClick", "");
}

function onLastClick() {
    __doPostBack("onLastClick", "");
}

function onFirstClick() {
    __doPostBack("onFirstClick", "");
}

function onGotoQuestionClick() {
    __doPostBack("onGotoQuestionClick", "");
}
         


function onQuestionKeyup(e) {

    var key;

    if (window.event)
        key = window.event.keyCode;     //IE
    else
        key = e.which;     //firefox

    if (key == 13) {
        __doPostBack("onQuestionKeyup", "");
    }
}

function __doPostBack(eventTarget, eventArgument) {
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
        theform = document.aspnetForm;
    }
    else {
        theform = document.forms["aspnetForm"];

    }

    //var theform = document.PortalTemplateForm;
    theform.__EVENTTARGET.value = eventTarget;
    theform.__EVENTARGUMENT.value = eventArgument;
    theform.submit();
}  

function onGridViewRowSelected(rowControlId, rowIdx)
{
     __doPostBack(rowControlId, rowIdx);
}

function onSelectRowClick(rowControlId, rowVal)
{
     __doPostBack(rowControlId, rowVal);
}

function onSearchTextKeyup(obj)
{    
     __doPostBack("Search", "");     
}

function PopUp(url, width, height)
{ 
 var left   = (screen.width  - width)/2;
 var top    = (screen.height - height)/2;
 var params = 'width='+width+', height='+height;
 params += ', top='+top+', left='+left;
 params += ', directories=no';
 params += ', location=no';
 params += ', menubar=no';
 params += ', resizable=yes';
 params += ', scrollbars=yes';
 params += ', status=yes';
 params += ', toolbar=no';


window.open(url,'mywindow',params);
}
